Generalisation relationship the advantages

advantage and disadvantage of generalization relationship class

We see the following relationships: owners feed pets, pets please owners ( association); a tail is a part of both dogs and cats (aggregation / composition); a cat is. How to use association, aggregation, and composition to define relationships between the objects in your application. Relationship between library and student is aggregation. Relationship between library and book is composition. A student can exist without a.

Association between Teacher and Student.

The Enhanced ER Model

Both can be created and deleted independently. An aggregation is a special type of association where all object have their own life cycle mean If one object contain other object and the contained object can exists or survive without container objectbut there is a ownership and the child object cannot belong to other parent object.

Aggregation also known as 'Has a' relationship For example: Chair in a room. Here Chair and room both have their own life cycle. Composition is a special form of aggregation. It is more restrictive than aggregation, where child object does not have their own life cycle and its depends on parents object.

Generalization relationships in UML models and diagrams

Bathroom in a House. The life time of a Faculties depends with the life time of the College. If college is disposed the Faculties will no longer exist.

generalisation relationship the advantages

But there is a subtle difference: Aggregation implies a relationship where the child can exist independently of the parent. Class parent and Student child. Delete the Class and the Students still exist.

generalisation relationship the advantages

Composition implies a relationship where the child cannot exist independent of the parent. House parent and Room child. Rooms don't exist separate to a House. We should be more specific and use the composition link in cases where in addition to the part-of relationship between Class A and Class B - there's a strong lifecycle dependency between the two, meaning that when Class A is deleted then Class B is also deleted as a result Aggregation Example: It's important to note that the aggregation link doesn't state in any way that Class A owns Class B nor that there's a parent-child relationship when parent deleted all its child's are being deleted as a result between the two.

generalisation relationship the advantages

Actually, quite the opposite! Summing it up - To sum it up association is a very generic term used to represent when on class used the functionalities provided by another class.

TEN BENEFITS OF BEING IN A RELATIONSHIP!!!

We say it's a composition if one parent class object owns another child class object and that child class object cannot meaningfully exist without the parent class object. If it can then it is called Aggregation.

Generalization relationships

Generalization vs Specialization Generalization is a mechanism for combining similar classes of objects into a single, more general class. Generalization identifies commonalities among a set of entities.

generalisation relationship the advantages

The commonality may be of attributes, behavior, or both. In other words, a superclass has the most general attributes, operations, and relationships that may be shared with subclasses.

generalisation relationship the advantages

A subclass may have more specialized attributes and operations. Specialization is the reverse process of Generalization means creating new sub classes from an existing class.