A brief summary of UML & Rational Rose – Class Diagrams, Part IV

本文介绍了类图,它用于展示系统中的类和类包,呈现系统各部分及其关系的静态画面,通常在逻辑视图中创建。还阐述了类的可见性设置,以及类之间的四种关系,包括关联、依赖、聚合、泛化,此外提到了实现关系,并给出示例类图。

6. Class Diagram <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

­A class diagram is used to display some of the classes and packages of classes in your system. It gives a static picture of the pieces in the system, and of the relationships between them.

­Please remember that we usually create a class diagram in the Logical View.

  

6.1 Setting Class Visibility

 

­Public suggests that the class can be seen by all of the other classes in the system.

­

Protected, Private suggests that the class can be seen in nested classes, friends, or within the same class.

 

­Package or Implementation suggests that the class can only be seen by other classes in the same package.

 

 

6.2 Class Relationships

 

 There are four types of relationships you can set up between classes:

  • ­Association

  • ­Dependencies

  • ­Aggregation

  • ­Generalization

 

Associations

­An association is a semantic connection between classes. An association allows one class to know about the public attributes and operations of other class.

­ Unidirectional & bidirectional associations exist in Rational Rose.

ClassDiagram_Associations.jpg



Dependencies

 

­A dependency relationship shows that a class references another class. A change in the referenced class specification may impact the using class.
ClassDiagram_Dependencies.jpg


Aggregations

­An aggregation is stronger form of association. An aggregation is a relationship between a whole and its parts.


ClassDiagram_Aggregations.jpg


Generalization

­A generalization is an inheritance relationship between two classes. It allows one class to inherit the public and protected attributes and operations of another class.

ClassDiagram_Generalization.jpg



Realization

­Realization indicates that one class implements behavior specified by another. It is permissible for one implementation class to realize another; this means that the realizing class must conform to the interface, but need not use inheritance.

ClassDiagram_Realization.jpg




There is a sample class diagram as follows.

ClassDiagram_Sample.jpg

转载于:https://www.cnblogs.com/rickie/archive/2004/08/10/32085.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值