0% found this document useful (0 votes)
36 views2 pages

Features of OOPs-24.07.2020-Part 2

Polymorphism allows a message to be displayed in multiple forms. It means an object can have different behaviors in different classes. Operator overloading and function overloading are examples of polymorphism in C++. Inheritance allows a subclass to inherit properties from a superclass. Dynamic binding determines which code to execute at runtime based on the object type, using virtual functions. Message passing allows objects to communicate by sending requests to invoke functions in other objects.

Uploaded by

mjcb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views2 pages

Features of OOPs-24.07.2020-Part 2

Polymorphism allows a message to be displayed in multiple forms. It means an object can have different behaviors in different classes. Operator overloading and function overloading are examples of polymorphism in C++. Inheritance allows a subclass to inherit properties from a superclass. Dynamic binding determines which code to execute at runtime based on the object type, using virtual functions. Message passing allows objects to communicate by sending requests to invoke functions in other objects.

Uploaded by

mjcb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Features of OOPs

Polymorphism: The word polymorphism means having many forms. In simple words, we can
define polymorphism as the ability of a message to be displayed in more than one form.
A person at the same time can have different characteristic. Like a man at the same time is a father,
a husband, an employee. So the same person posses different behaviour in different situations.
This is called polymorphism.

An operation may exhibit different behaviours in different instances. The behaviour depends upon
the types of data used in the operation.

C++ supports operator overloading and function overloading.

 Operator Overloading: The process of making an operator to exhibit different behaviours in


different instances is known as operator overloading.
 Function Overloading: Function overloading is using a single function name to perform
different types of tasks.
Polymorphism is extensively used in implementing inheritance.
Example: Suppose we have to write a function to add some integers, some times there are 2
integers, some times there are 3 integers. We can write the Addition Method with the same name
having different parameters, the concerned method will be called according to parameters.

Inheritance: The capability of a class to derive properties and characteristics from another class is
called Inheritance. Inheritance is one of the most important features of Object-Oriented
Programming.
 Sub Class: The class that inherits properties from another class is called Sub class or
Derived Class.
 Super Class:The class whose properties are inherited by sub class is called Base Class or
Super class.
 Reusability: Inheritance supports the concept of “reusability”, i.e. when we want to create a
new class and there is already a class that includes some of the code that we want, we can
derive our new class from the existing class. By doing this, we are reusing the fields and
methods of the existing class.
Example: Dog, Cat, Cow can be Derived Class of Animal Base Class.

Dynamic Binding: In dynamic binding, the code to be executed in response to function call is
decided at runtime. C++ has virtual functions to support this.
Dynamic binding also called dynamic dispatch is the process of linking procedure call to a specific
sequence of code (method) at run-time. It means that the code to be executed for a specific
procedure call is not known until run-time. Dynamic binding is also known as late binding or run-
time binding.

Dynamic binding is an object oriented programming concept and it is related


with polymorphism and inheritance.

Definition:
Dynamic binding means that a block of code executed with reference to a procedure(method) call is
determined at run time.

Dynamic dispatch is generally used when multiple classes contain different implementations of the


same method. It provides a mechanism for selecting the function to be executed from various
function alternatives at the run-time. In C++, virtual functions are used to implement dynamic
binding.

Message Passing: Objects communicate with one another by sending and receiving information to
each other. 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 results. Message passing
involves specifying the name of the object, the name of the function and the information to be sent.

You might also like