zoukankan      html  css  js  c++  java
  • Class diagrams

    So far we have seen stack diagrams, which show the state of a program, and object diagrams, which show the attributes of an object and their values. These diagrams represent a snapshot in the execution of a program, so they change as the program runs. They are also highly detailed, and for some applications, too detailed. A class diagrams is a more abstract representation of the structure of a program. Instead of showing individual objects, it shows classes and the relationships between them.

    There are several kinds of relationship between classes:

    • Objects in one class might contain references to objects in another class. For example, each Rectangle contains a reference to a Point, and each Deck contains references to many Cards. This kind of relationship is called HAS-A, as in, ‘a Rectangle has a Point.’
    • One class might inherit from another. This relationship is called IS-A, as in, ‘a Hand is a kind of a Deck.’
    • Once class might depend on another in the sense that changes in one class would require changes in the other.

    A class diagram is graphical representation of these relationships between classes. For example, this diagram shows the relationship between Card, Deck and Hand.

                           

    The arrow with a hollow triangle head represents an IS-A relationship; in this case it indicates that Hand inherits from Deck. The standard arrow head represents a HAS-A relationship; in this case a Deck has references to Card objects. The star(*) near the arrow head is a multiplicity; it indicates how many Cards a Deck has. A multiplicity can be a simple number, like 52, a range, like 5..7 or a star, which indicates that a Deck can have any number of Cards.

    from Thinking in Python

  • 相关阅读:
    windows mysql 的myini
    NuGet 程序源包
    链表更新
    程序包需要 NuGet 客户端版本“XXXXX”或更高版本,但当前的 NuGet 版本为“XXXXXXXXXX”
    chrome下调试安卓app 之 ionic
    ionic3 在ios9.0 系统下 会出现ReferenceError:Can't find variable:Intl 错误提示
    抓取html 生成图片
    grunt 打包 分解(并非原创)
    关于 vue 日期格式的过滤
    Android Studio
  • 原文地址:https://www.cnblogs.com/ryansunyu/p/4008563.html
Copyright © 2011-2022 走看看