57. Four Pillars of Object-Oriented Programming

* Encapsulation 
* Data Hiding
* Inheritance
* Polymorphism


C++ Fully supports object-oriented programming.

Encapsulation: -Being a self contained unit.

Data hiding: -An object can be used without knowing about its internal data members.

Encapsulation and Data Hiding:

* C++ supports encapsulation and data hiding through
* The creation of user-defined types, called classes.
* A well-defined class acts as a 


  -  Fully encapsulated entity--it is used as a whole unit.
  - The actual inner workings of the class are hidden.
  - Users of a well-defined class do not need to know how the class works.
  - They just need to know how to use it.

Inheritance and Polymorphism: 

* Inheritance

 
  - a new object type, which is an extension of an excising type can be declared
  - This new subclass is said to derive from the existing type and is sometimes called a derived type.
  - C++ supports reuse through inheritance.

* Polymorphism

 
  - refers to the same name taking many forms.
  - C++ Supports the idea that different objects do "the right thing" through.
  - Function polymorphism and class  polymorphism

No comments:

Post a Comment

free counters