10 March 2013

OOPS Object Oriented Programming FAQ

OOPS  -  Object Oriented Programming  FAQ

Four main principles of OOPS
1. Encapsulation
2. Inheritance
3. Polymorphism
4. Abstraction

1. Encapsulation
- Encapsulation is the process of hiding the irrelevant information and showing only relevant information to                  the user.
- Encapsulation is the process of wrapping up of data and member in a class.

Example:
- Only specific method or properties can access the private member of class.
- Data Hiding through the private class access specifier.

Uses:
-Increase the maintainability of the code by showing only relevant information to the User.


2. Abstraction
- Abstraction is the process of hiding the details and exposing only the essential feature of particular concept or object.

Real time example:
Refrigerator:
The process of showing the general information related to the refrigerator is called Abstraction and hiding the complex information from the user is Encapsulation.


3.Inheritance
- Inheritance is the process through which a child class obtain the feature defined its parent class.
- Used for reuse of code and eliminate redundant code.

Types:
- Single, Multilevel, Multiple and Hierarchical.

4.Polymorphism
- One Interface multiple methods
- With the help of Polymorphism we can use one procedure in many ways based on our requirement.

Method Overloading:
-Method according to number and types of parameter.

Operator Overloading:
-Change the functionality of operator.

Runtime Polymorphism
Overriding
-Overriding is the feature that allows derived class to provide a specific implementation of a method that is already provided its base class.

No comments:

Post a Comment

Comments Welcome

Consistency level in Azure cosmos db

 Consistency level in Azure cosmos db Azure Cosmos DB offers five well-defined consistency levels to provide developers with the flexibility...