Xiaobo Sun

Eclipse-Unix http://umlfact.berlios.de/~s_xsun/

Composition & Aggregation

Composition: b's lifetime is up to its context (object of A).
==C++==
class A{
    B b;
}
==java==
class A{
    B b;
    public A(){
       b = new B();
    }
}

Aggregation: b can live without its context (object of A).
============================================
==C++==
class B{
    B* b;
}
==java==
class B{
    B b;
    public A(B b){
       this.b = b;
    }
}

posted on 2007-07-12 16:39 Xiaobo Sun 阅读(279) 评论(0)  编辑  收藏 所属分类: UML


只有注册用户登录后才能发表评论。


网站导航:
 
<2007年7月>
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

导航

统计

常用链接

留言簿(3)

随笔分类

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜