Features of OOP

Features of OOP

The main Features of OOP are as follows:
1.    Classes
2.    Object
3.    Inheritance
4.    Polymorphism
5.    Encapsulation
6.    Data Abstraction
7.    Message passing

1.    Classes: A class represents a group of Objects that share common properties, Behaviors, and relationship. A class is a blueprint or template which describes characteristics of the similar object. In other words, a class is an identifier which is general name defined to represent objects of similar characteristic.

2.    Objects: An object is an identifiable entity with some characters and behavior. An object is an instance of the class. Creating an object of a class is like defining a variable of a data type. Once a class has been declared, we can create variables of that type by using the class name.


Inheritance
Inheritance is the ability to create a new class from existing class with new data and method. Existing class is called base classes and the newly created classes are called derived classes. The derived class inheritance all the features except private member inherent in the base class

Example:
 


Polymorphism
The word ‘poly’ means ‘Many’ and ‘morphe’ means forms. Thus, polymorphism means the ability to take more than one form. The OOP supports polymorphism through function overloading, operator overloading, function overriding and template.
Encapsulation
Encapsulation is an ability to bind function and data together in a place and hide the data from unauthorized users from other parts of the program.

Abstraction
Abstraction refers to an act of representing essential features without including background details. Thus, data abstraction is the methodology that supports the use of compound objects without its detail knowledge.

Message Passing

Object can communicate with each other by passing message same as people pass a message with each other. An object can send and receive a message from/to another object. A message for an object is a request for execution of a procedure. 

No comments:

Powered by Blogger.