Object Oriented Programming with C++ PDF

Summary

These lecture notes cover Object Oriented Programming concepts in C++. Topics include classes, objects, inheritance, polymorphism, and message passing. The notes also discuss data abstraction and encapsulation.

Full Transcript

Object Oriented Programming with C++ Module V Ms Jeena Joseph Assistant Professor Department of Computer Applications Marian College Kuttikkanam[Autonomous] Module V Introduction to OOPS, Basic OOPS Concepts, Classes and Objects, Access Specifier...

Object Oriented Programming with C++ Module V Ms Jeena Joseph Assistant Professor Department of Computer Applications Marian College Kuttikkanam[Autonomous] Module V Introduction to OOPS, Basic OOPS Concepts, Classes and Objects, Access Specifiers (public, private, protected) Constructors and Destructors Static Members (Variables, Methods) Encapsulation and Abstraction Basic Concept of Object-Oriented Programming Objects Classes Data abstraction and encapsulation Inheritance Polymorphism Dynamic binding Message passing Objects Basic run-time entities in an object-oriented system. They may represent a person, a place, a bank account, a table of data or any item that the program has to handle. Programming problem is analyzed in terms of objects and the nature of communication between them. Objects take up space in the memory and have an associated address. Two ways of representing an object Object : Student1 DATA Name Total Date of birth Marks FUNCTIONS Total Average Average Display Display Classes The entire set of data and code of an object can be made user- defined data type with the help of a class. Objects are variables of the type class. Each object is associated with the data of type class with which they are created. A class is a collection of objects of similar type. Data Abstraction and Encapsulation Wrapping of data and functions into a single unit is known as encapsulation. Data is not accessible to the outside world, and only those functions which are wrapped in the class can access it. Insulation of the data from direct access by the program is called data hiding or information hiding Data Abstraction and Encapsulation Abstraction refers to the act of representing essential features without including the background details or explanations. Attributes are sometimes called data members because they hold information. The functions that operate on these data are sometimes called methods or member functions. Since the classes use the concept of data abstraction, they are known as Abstract Data Types (ADT). Inheritance Process by which objects of one class acquire the properties of objects of another class. Support the concept of hierarchical classification. Inheritance provides the idea of reusability. We can add additional features to an existing class without modifying it. Polymorphism Ability to take more than one form. An operation may exhibit different behaviors in different instances. Behaviour depends upon the types of data used in the operation. The process of making an operator to exhibit different behaviors in different instances is known as operator overloading Dynamic Binding Binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic Binding means that the code associated with a given procedure call is not known until the time of the call at run-time. Associated with polymorphism and inheritance. Message Passing Object-oriented program consists of a set of objects that communicate with each other. Creating classes that define objects and their behaviour. Creating objects from class definitions Establishing communication among objects. Message passing A message for an object is a request for execution of a procedure, and therefore will invoke a function in the receiving object that generates the desired result. Eg: Benefits of OOP Object orientation contributes to the solution of many problems associated with the development and quality of software products. Technology Promises  Greater programmer productivity.  Better quality of software.  Lesser maintenance cost. Benefits of OOP Through inheritance, we can eliminate redundant code and extend the use of existing classes. Build programs from the standard working modules that communicate with one another. Save development time and higher productivity. Benefits of OOPs The principle of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of the program. Multiple instances of an object to co-exist without any interference. Possible to map objects in the problem domain to those in the program. Easy to partition the work in a project based on objects. Benefits of OOPs Data-centered design approach enables to capture more details of a model in implemented form. Easily upgraded from small to large systems. Message passing makes the interface description with external systems much simpler. Software complexity can be easily managed.

Use Quizgecko on...
Browser
Browser