C++ OOPs

OOP :  Object Oriented Programming.

Object Oriented Programming aims to implement real world entities like inheritance, hiding,  polymorphism, etc. , in programming.

The main aim of OOP is to bind together data and the functions that operate on them so that no other part of the code can be access this data except the function.

OOPs Concepts:

1. Class

2. Object

3. Encapsulation

4. Abstraction

5. Inheritance

6. Polymorphism

Class : Class is a user defined data type, which holds its own data members and member functions, which can be accessed and used by creating an instance o that class. 

A class is like a blueprint for an object.

Object : An object is an instance of a class. When a class is defined, no memory is allocated but when it is instantiated (i.e. an object is created) memory is allocated.

Encapsulation : Encapsulation is defined as binding together data and the functions that operate on that data.

Abstraction :  Data Abstraction refers to providing only essential information about the data to the outside world, hiding the background details or implementation. 

Inheritance : Inheritance is the procedure in which one class inherits the attributes and methods of another class.

Polymorphism : Polymorphism is the ability of a message to be displayed in more than one form.

Polymorphism is extensively used in implementing inheritance.

Advantage of OOPs over Procedure-oriented programming language

  1. OOPs makes development and maintenance easier where as in Procedure-oriented programming language it is not easy to manage if code grows as project size grows.
  2. OOPs provide data hiding whereas in Procedure-oriented programming language a global data can be accessed from anywhere.
  3. OOPs provide ability to simulate real-world event much more effectively. We can provide the solution of real word problem if we are using the Object-Oriented Programming language.