Professional Documents
Culture Documents
2 Unit 1 06 01 2024
2 Unit 1 06 01 2024
Objects
• OOP uses objects as its fundamental building blocks.
• Objects are the basic run-time entities in an object- oriented system.
• Every objectis associated with data and functions which define
meaningful operations on that object.
• Object is a real world existing entity.
• Object is an Instance of a particular class.
Object
Example:
• class Dog
• {
• char name[20];
• char color[10];
• public:
• void details(){}
• };
•
• int main()
• {
• Dog obj; // obj is a object
• }
Encapsulation:
• Wrapping up of data and functions into a single unit
(class) is called encapsulation.
• Data is not accessible to outside world.
• Only those functions which are wrapped in the class can
access it.
Data Abstraction:
• A data abstraction is a simplified view of an object that
includes only features one is interested in while hides away
the unnecessary details.
• Data abstraction becomes an abstract data type
• (ADT)or a user-defined type.
Inheritance
• Inheritance is the mechanism to provides the power of
reusability and extendibility.
• Inheritance is the process by which one object can
acquire the properties of another object.
Inheritance
• Super Class: The class from which the properties are inherited by the sub
class/child class.
• Sub Class: The class which inherits the properties from the super class/parent
class.
• Inheritance helps you do the separation of the same fields and functionality
so that it can be reused in other classes. And this helps in code redundancy.
Polymorphism
• Poly means many. Morphism means forms.
• Polymorphism means that the same thing can exist in two forms.
• Polymorphism is in short the ability to call different functions by just using
one type of function call.
• Ex : Bank can be used as - bank (river)
•- bank (finance)
Message Passing
• Information or message of one object can be sent to other object.
• Object communicate with one another by sending and receiving
information much the same way as people communicate with each other.
• A message for an object is a request for execution of a procedure and it will
invoke a procedure in receiving object that generates the desired result.
• Message passing involves specifying the name of the object, the name of
the function and the information to be sent.
• Ex- employee.salary(name);
• Data Binding
• Binding means to bind one thing to another one. Here in OOPS, binding
refers to linking some attribute of one object to another one in the
Application.
• There are two main types of binding:
• Static Binding
• Dynamic binding
• Static Binding
• In static binding, the property of one object is changed directly without
changing the other property.
• Dynamic Binding
• When any object is determined at the run time, then it is known as dynamic
binding.
• Dynamic Binding occurs when the property of one object changes, and due to
this, the property of another object gets changed
•