Designing Java applications with UML class diagrams (ii)

Source: Internet
Author: User
Tags abstract

In the first section, we implemented 5 classes. In this section, we then show you how to use UML class diagrams to design the remaining classes. To reduce space, this section focuses on UML class diagrams and applications, the Java implementation code is no longer described in detail.

Six, Cgpoint class

The Cgpoint class illustrates how to extend an abstract class with a Non-abstract class. The Cgpoint class is a subclass of Cgobject, the Cgpoint class extends the Cgobject class, and the Cgpoint class does not add a variable to the variable it inherits, the method it declares is only a constructor and an abstract method that requires it to implement. Its class diagram is as follows:

The Java implementation code is:

Seven, Cgbox class

The Cgbox class also extends the Cgobject class. The Cgbox class provides additional variables for displaying rectangles on a grid. The class diagram of the Cgbox class is as follows:

The corresponding code is:

Related Article

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.