一、横向关系:
1.depedency依赖,use-a
是类之间的一种很弱的联系
,
use-a
,send-a,parameter-a
关系,常用是将一个类对象作为一个类里面方法的参数。是偶然的,临时的,
对象间是并列关系
调用了一个对象,以利用它的成员。
2.association关联,use-a
他体现的是两个类、或者类与接口之间语义级别的一种强依赖关系,比如我和我的朋友;这种关系比依赖更强、;是固定的、长期的、对象间是并列的、可单向或双向的,
1被关联类对象以类属性的形式出现在关联类中,2也可能是关联 类A引用了一个类型为被关联类B的全局变量。一般不是依赖、聚合和组合的非整体与局部(特别是对类的全局变量引用
)就说关联关系。
属于关联下的聚合和组合关系(整体与局部关系):
3.aggregation聚合,has-a异步
,学校与学院,用到了类a,因为要用类a的成员。弱的整体与局部关系,因为有a对象,但是a对象也可以被其他类拥有。他们之间不是生死与共的生命周期,然后是局部对象作为整体类的属性,
局部的对象是可以在外面先创建的,可以被多个整体类调用,毁灭时不一定毁灭它。
A relationship B用实线空菱形箭头表示。
整体类属性,创建时间,其它类调用,毁灭时间。
4.composition组合,contain-a同步
,窗口与菜单按钮,包含a,强的整体与局部的关系,拥有了a,且有且仅有它拥有a对象,是生死与共的生命周期,将局部的对象作为整体类的属性,创建时创建,只有被当前类使用,特别是毁灭时毁灭。
A relationship B用实线实心菱形表示。
整体类属性,创建时间,其它类调用,毁灭时间。
在C++语言中,从实现的角度讲,聚合可以表示为:
class A {...}
class B { A* a; .....} //* a只是引用指针,也就是A对象的创建不在这里。
即类B包含类A的指针;
而组合可表示为:
class A{...}
class B{ A a; ...}
即类B包含类A的对象。
其关系强弱为dependency<association<aggregation<composition
二、纵向关系:
5.implements,
实现接口 虚线实体大箭头表示.
6.extends IS-a
就是继承关系了,当添加了新的方法就是is-like-a,应该首先考虑组合而不是继承,因为组合可以毫不影响引用类,且可以动态的修改新类的成员(来自java编程思想)。泛化: 继承实现方法多态的形式,实线大箭头表示。
分享到:
相关推荐
出现报错 ...Possible solutions: ...- Add a mirror(s) for ----------- - Downgrade Maven to version 3.8.1 or earlier in settings ---------------------------------------------------------对号入座
When mapping from an ER model to a relational model, a strong entity is mapped into a (a) table (b) row (c) column (d) key Correct answer is (a) 10. Which of the following is true about ...
IEEE 1588 may contain patented technology, the use of which is not under the control of the authors of PTPd. Users of IEEE 1588 may need to obtain a license for the patented technology in the ...
- A hang on startup has been corrected. A 2 minute timeout has been added to the collection of system information. - Video playback, Hard disk and CD/DVD test 'no operations' error reporting ...
contain bugs, so use of this tool is at your own risk. We take no responsibility for any damage that may unintentionally be caused through its use. You may not distribute Unlocker in any form without...
Zim is a graphical text editor used to maintain a collection of wiki pages. Each page can contain links to other pages, simple formatting and images. Pages are stored in a folder structure, like in an...
The described method exploits the fact, that the system contains two channels, where both channels contain a CPLD. During a test one CPLD is configured using a modified programming file. This file ...
Hidden Bits : A Survey of Techniques for Digital Watermarkingm contain matlab code., work picz overview (.doc ) file (.ppt) file
Django has a lot of documentation. A high-level overview of how it’s organized will help you know where to look for certain things: Tutorials take you by the hand through a series of steps to create...
Django has a lot of documentation. A high-level overview of how it’s organized will help you know where to look for certain things: • Tutorials take you by the hand through a series of steps to ...
* 掌握生活词汇:grocer's、heart rate、contain等。 * 掌握 Distance词汇:distance race等。 三、语法知识点 * 掌握基本句子结构:例如"What was he doing at a meeting?"等。 * 掌握标点符号的使用:例如问号、...
Also Roger has made the IPAddress property obsolete (do not use it, use Host instead), SakEmail will resolve the host properly no matter if it is a host name or a IP address. So in the next version I...
a : has ( > img) { /* style links that contain an image */}h1 : has( + p) { /* style level 1 headings that are followed by a paragraph */}section : not ( : has ( h1 , h2 , h3 , h4 , h5 , h6 )) { /* ...
output trace mechanism and has a much larger code and data size. Previous Release: Non-Debug Version: 78.1K Code, 17.1K Data, 95.2K Total Debug Version: 155.4K Code, 63.1K Data, 218.5K Total ...
Allows you to bind a function to be executed when the DOM document has finished loading. This function behaves just like $(document).ready(), in that it should be used to wrap other $() operations on ...
A form can contain checkboxes, textfields, radio- buttons and many more. Forms are used to pass user- data to a specified URL which is specified in the action attribute of the form tag. Interface ...
SQUASHFS 2.2 - A squashed read-only filesystem for Linux Copyright 2005 Phillip Lougher (phillip@lougher.demon.co.uk) Released under the GPL licence (version 2 or later). Welcome to Squashfs ...
A project model for the FreeBSD Project Niklas Saers Copyright © 2002-2005 Niklas Saers [ Split HTML / Single HTML ] Table of Contents Foreword 1 Overview 2 Definitions 2.1. Activity 2.2. Process ...
快速参考与语言参考A-Z 文档还提供了快速参考指南和详尽的语言参考,列出了所有可用的函数和语句,如 `ABS`、`APPACTIVATE`、`ASCFUNCTION` 等,便于开发者快速查阅和使用。 总之,CypressEnable for Mach 是一个...