Aggregation (HAS-A)
HAS-A relationship is based on usage, rather than inheritance. In other words, class A has-a relationship with class B, if code in class A has a reference to an instance of class B.
example
class Student { String name; Address ad; } here we say that student has-a address
时间: 2024-11-16 13:36:56