Java Aggregation (HAS-A relationship)

ref: http://www.studytonight.com/java/method-overriding-in-java.php

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




原文地址:https://www.cnblogs.com/morningdew/p/5618879.html