Java Aggregation (HAS-A relationship)

Posted morningdew

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java Aggregation (HAS-A relationship)相关的知识,希望对你有一定的参考价值。

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

技术分享

 

 

 

 




以上是关于Java Aggregation (HAS-A relationship)的主要内容,如果未能解决你的问题,请参考以下文章