Objects, classes, encapsulation, inheritance, polymorphism, and dynamic binding are the basic concepts of object-oriented programming (OOP). An object is an instance of a class that can interact by sending and receiving messages. A class defines common attributes and behaviors of objects. Encapsulation binds together an object's data and functions, while inheritance establishes a hierarchy where derived classes inherit attributes of base classes. Polymorphism allows the same message to be interpreted differently depending on context, and dynamic binding connects method calls to code at runtime.
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
file_1670410681781.pptx
1. Basic OOP Concepts
Objects
Class
Data abstraction
Data encapsulation
Inheritance
Polymorphism
Dynamic binding
Object: An object may represent a person, place or data concerned to real
world task. Every object must be a member of particular class. Objects
interacts with each other by sending messages to one another.
It is an instance of a class.
Ex: two-wheeler, four-wheeler are the objects of a class vehicles.
Class: A class is a way of grouping objects having similar characteristics.
Once the class is defined, any number of objects of that class are created.
Ex: planets, sun, moon, are members of class solar system.
Chapter 6
OOP
Concepts
2. Abstraction: Abstraction refers to the process of representing essential operational
features without including
background details or explanations.
Data Encapsulation
The wrapping of data and functions in to a single unit is called Data Encapsulation
Inheritance:
• Inheritance is the process by which one object can acquire and use the
properties of another object.
• The existing class is known as base class
• The new class is known as derived class
• The derived class shares some of the properties of the base class.
Therefore a code from a base class can be reused by a derived class
3. Polymorphism:
• The ability of an operator and function to take multiple forms is
known as Polymorphism.
• The different types of polymorphism are
operator overloading and
function overloading.
Overloading allows objects to have different meaning depending
upon context
•
When an existing operator operates on new data type is called operator
overloading.
• Function overloading means two or more function have same, but
differ in the number of
arguments or data type of arguments.
// This is automatically called when '+' is
used with
// between two Complex objects
Complex operator + (Complex const
&obj) {
Complex res;
res.real = real + obj.real;
res.imag = imag + obj.imag;
return res;
}
4. Dynamic binding:
• Binding is the process of connecting one program to another.
• Dynamic binding is the process of linking the procedure call to a
specific sequence of code or function at run time or during the
execution of the program.
Message Passing:
• In OOP’s, processing is done by sending message to objects.
• A message for an object is request for execution of procedure
Advantages of OOP
1. Programs are modularized based on the principle of classes and
objects.
2. Data is encapsulated along with the functions. This provides
controlled data access and
thereby secures data.
3. Linking code and object allows related objects to share common
code. Hence provides
reusability.
4. Complexity can be minimized through inheritance.
5. reduces software develop time
5. Limitations of OOP
1. OOP software is not having set standards.
2. The classes are overly generalized.
3. It is difficult to convert real world problem into object oriented model.
4. The adoptability of flow diagrams and OOP using classes and objects
is a complex process.