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

 

 

 

 




posted @ 2016-06-26 23:28  morningdew  阅读(315)  评论(0编辑  收藏  举报