×
Don’t watch the clock; do what it does. Keep going.
--Your friends at LectureNotes
Close

Object Oriented Programming Using Cpp

by Manju BashiniManju Bashini
Type: NoteCourse: B.Tech Specialization: Electronics and Instrumentation EngineeringOffline Downloads: 341Views: 8446Uploaded: 1 year ago

Share it with your friends

Suggested Materials

Leave your Comments

Contributors

Manju Bashini
Manju Bashini
CS6456 OBJECT ORIENTED PROGRAMMING UNIT 1 OVERVIEW Why Object-Oriented Programming in C++ - Native Types and Statements –Functions and Pointers- Implementing ADTs in the Base Language. SOFTWARE DEVELOPMENT Software: Software is defined as a collection of programs to do a specific task. The person who is using the software is called end-user. Objectives of software development: I. It must satisfy the end-user. II. Development cost must be minimum. III. It should take minimum amount of development time. IV. It should be reliable V. It should be reusable. The objectives are:  Correctness  Maintainability  Reusability  Openness and interoperability  Portability  Security  Integrity  User friendliness Software Evaluation: 1
 Machine language – it uses 0’s and 1’s for writing programs. It is very difficult to write and correct errors. It is machine dependent.  Assembly language – it uses symbolic codes for writing programs. It is difficult to write and correct errors. It is machine dependent.  Procedure oriented programming – it uses high level languages like COBOL, PASCAL and C. We use functions, procedures and different data structures for writing programs.  Object -oriented programming – it uses high level languages like c++, java etc. it has a collection of discrete objects incorporated with data structures and its behavior. Procedure oriented programming: Features: I. Large problems are divided in to smaller problems known as functions or procedures. II. It is top down programming technique. III. Data moves freely from one function to another. IV. Function can share global variables. V. Data hiding is not possible. Object oriented programming paradigm:  The given problem is divided into number of entities called objects.  The related functions, data and its structures are all defined inside the objects.  The data inside the objects are called attributes and the related functions are called operations.  The data of an object can be accessed only by the function associated with that object.  Finally all the objects are interfaced to solve the problem. Consider a problem to design a computer system: This problem is divided into three objects namely I. Monitor II. Keyboard III. CPU 2
Features of Object oriented programming: 1. Programs are divided in to objects. 2. It is not possible to access data freely. 3. Data hiding is possible. 4. It is bottom-up programming technique. 5. It is easy to add new data and functions. 6. Objects can exchange data through its function Object oriented programming concepts: 1. Objects 2. Class 3. Data Abstraction 4. Encapsulation 5. Inheritance 6. Polymorphism 7. Dynamic binding 8. Message passing 1. Objects:  Objects are the Basic run time entities. 3
 They may represent a person, a place, a bank account that the program has to handle.  An instance of a class is called object.  We can create any number of objects related to the class. Each object contains data and code to manipulate data. The following fig. shows the two ways to represent objects. • The problem is divided into number of entities called objects. • The data inside the objects are called attributes and related functions are called operations. Ex: computer Objects – monitor, keyboard and CPU Object = Data + Methods NEED FOR OBJECTS: • Modularity - large software projects can be split up in smaller pieces. • Reusability - New software components can be written or developed from existing ones Everything in the world is an object • • • • • • A flower, a tree, an animal A student, a professor A desk, a chair, a classroom, a building A university, a city, a country The world, the universe A subject such as CS, IS, Math, History, … 2. Class: Class is template for an object. It is a collection of objects with same type of data and functions. We can create any number of objects related to the class. Data items in a class are called data members. The function with in a class is called member functions. (User defined class) Example: class name – fruit 4

Lecture Notes