Thursday, February 25, 2016

OOPs!

The basic elements of Object Oriented Programming are:

Classes
Classifies/categorizes an object(=thing) or a group of objects in a context based on certain specifications - attributes and behavior.

Objects
An object represents a particular instance of a class. There can be more than one instance of a class. An Object is a collection of data members(=attributes/data) and associated member functions (=behavior/methods).

Data Abstraction
Abstraction refers to the act of representing essential features without including the implementation details.

a Car, for an instance, would be made up of an Engine, Gearbox, Steering objects, and many more components. To drive a Car, one does not need to know, how the different components work together internally but to control the steering and applying the gears (interfacing it).

Data Encapsulation
Wrapping up of data and its functions into a single unit is called Encapsulation. Data is not accessed directly in this case but through the methods inside the class.

Inheritance
Inheritance is the process of creating a new class from an existing class. Inheritance helps in reducing the overall code size of the program and promotes code re-usability.

Classified as 1) single and 2) Multiple (implementation) inheritances.

Polymorphism
In Greek, “Poly” means many, and “morph” means form. One name with many forms is called Polymorphism. It allows objects of different types to be treated similarly. This can be implemented in C++ via the inheritance hierarchy, also known as sub type polymorphism.

No comments :

Post a Comment