-
Junior Member
Inheriitance and Aggregation
What is the difference btn inheritance and aggregation when do u use one another?
-
Contributing Member
Re: Inheriitance and Aggregation
Inheritance is used for an IS-A relationship.
Aggregation is used for a HAS-A relationship.
EG:
Cars, Scooters are vehicles. (Inheritance)
Car has a steering, wheel etc. (Aggregation)
In Inheritance, a class inherits the properties of the base class.
In Aggregation, a class uses the properties of some other class.
Regards,
Sahil.
-
Junior Member
Re: Inheriitance and Aggregation
Inheritance is the process where one object acquires the feature of another
object. It depicts is-a relationship. Like car is-a vehicle.
Aggregation deals with Has-a relationship. For example car has engine..
here engine is an object which is a part of another object called car.
Regards,
Krishna.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules