Sunday, September 11, 2016

OOPS Concepts

1) What is polymorphism?
When one task is performed by different ways
Method Overriding and Method Overloading

2) What is inheritance?
Inheritance allows a Child class to inherit properties from its parent class

3) What is an abstraction ?(salesforce Access Specifies)
Hiding internal details and showing functionality is known as abstraction. For example: phone call, we don't know the internal processing.

4) What is Encapsulation?
Binding (or wrapping) code and data together into a single unit is known as encapsulation. For example: capsule, it is wrapped with different medicines.

5) What is Association?
Association is a relationship where all object have their own life-cycle and there is no owner. Let's take an example of Teacher and Student. Multiple students can associate with single teacher and single student can associate with multiple teachers.

6) What is Aggregation?
Aggregation is a specialize form of Association where all object have their own life-cycle but there is ownership and child object can not belongs to another parent object. Let's take an example of Department and teacher. A single teacher can not belongs to multiple departments, but if we delete the department teacher object will not destroy.

7) What is Composition ?
Composition is again specialize form of Aggregation and we can call this as a "death" relationship. It is a strong type of Aggregation. Child object dose not have their life-cycle and if parent object deletes all child object will also be deleted. Let's take again an example of relationship between House and rooms. House can contain multiple rooms there is no independent life of room.

No comments:

Post a Comment