Object Oriented Programming – CS2203 notes.
Basics of Unit 1
Basic Concepts :
3. Data Abstraction & Encapsulation
6. Dynamic Binding
7. Message Passing
An object is a runtime entity in object oriented system representing data items. Once objects are created, certain memory space is occupied on creation. There is some interaction between the objects too.
For ex. “Customer” Object can interact with the “Customer Account” Object
The entire set of code and data can be made into user defined data type. A class is a template and the objects are the variables of the type, class. ‘n’ number of object can be created from the class.
Classes are user defined
Data Abstraction and Encapsulation:
Encapsulation is the process of wrapping up functions and data into a class. The data in the class is not used outside it. The functions of the object acts as an interface between the object data and the outside code.
Data Hiding or Information hiding is the act of hiding data in an object.
Abstraction is the act of representing essential feature without including background details in the explanation.
Inheritance : It is the process in which the objects on one class acquires properties of object of another class. It helps in the concept of hierarchical classification.
Polymorphism : Polymorphism means many shapes.(poly = many , morph = shapes ) . It is the ability to take more than one form. It can be done in two ways.
· Operator overloading
· Function overloading
Operator overloading is the process of making an operator behave differently in different instances.For ex. The + operator can be overloaded to do concatenation of strings other than just adding up the numbers.
Function overloading is the act of using a single function name to perform different types of tasks.
Dynamic Binding or Late Binding : In dynamic binding the code associated with given process call is not known until runtime.
Message Passing : It refers to creating class that defines objects and its behavior and the objects which in turn created, communicate through member functions or data members. The communication between the objects is possible until the object is alive.
Advantages of OOPS :
· Eliminates Redundant code
· Code Reusability
· Data hiding enables secure programs
· Partition of the program into specified classes and functions