Personal Reflection: Has A Relationship And Is, A Relationship

1269 Words6 Pages
Name : Carson Lim Khai Xiang Student ID : 0314435 Personal Reflection Generally from my understanding, Has-a relationship and Is-a relationship are type of relationships to determine themselves within composition and inheritance between objects and instances. Has-a relationship Has-a relationship in an object is called the member of the field, which is also known as aggregation or composition in OOP language. This is to show that object is a composite relationship with another object. There is a tiny difference between aggregation and composition, where composition is when the object and member of the field has a strong association and for aggregation is loosely associated. This means that the object physically has something within itself, for example a Car has an Engine this is a Composition relationship and for Aggregation relationship is that a Car has a Driver. Has-a relationship has a productive way of code reusing where it is hard to achieve with inheritance relationship (Is-a relationship). Hence, when the goal is code reusing, Has-a relationship is a better choice compared to Is-a relationship. Is-a relationship Is-a relationship in a class is inheritance of the parent class where the child class is a subclass of the parent class. This is to show that the child is an inheritance relationship to the parent class. The “extends” is the key word which can identify that the class is a IS-a relationship or not. This means that the child class inherits

More about Personal Reflection: Has A Relationship And Is, A Relationship

Open Document