Why do the arrows inherited from the UML class diagram point to the parent class?

Source: Internet
Author: User

Let's first create a question to write the running results of the following programs:

Public class test {<br/> Public static void main (sting ARGs []) {<br/> child = new child (); <br/>}</P> <p> Class Parent {<br/> parent () {<br/> system. out. println ("parent. "); <br/>}</P> <p> class delegate {<br/> delegate () {<br/> system. out. println ("delegate. "); <br/>}</P> <p> class Child extends parent {<br/> child () {<br/> system. out. println ("child. "); <br/>}</P> <p> delegate = new delegate (); <br/>}
Class diagram of the previous program:

The output result is as follows:
Parent.
Delegate.
Child.
We can see that the direction of the inherited arrow is set to the direction that the parent class represents the dependency. Dependency refers to a relationship between two elements. One element changes and another element changes. In UML, a hollow arrow pointing from the subclass to the parent class is used to represent inheritance, which implies that changes in the parent class may lead to changes in the subclass.
Back to the question, according to the original "dependent first constructor, dependent on the human latter constructor", class child inherits from Class Parent, meaning that the former depends on the latter, the child's clustering relationship for delegate also means similar dependencies.
This article draws from Chapter 24th of "Software Architecture Design" by using Graph Theory to learn UML.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.