Unified Modeling Language Class Diagrams

6.5 Unified Modeling Language Class Diagrams

A class and its members can be described graphically using Unified Modeling Language (UML) notation.
Layout of a UML diagram for a class
  • The top box in the UML diagram contains the name of the class.
  • The middle box contains the data members and their data types.
  • The last box contains the method names, parameter list, and return types.
  • To indicate the data type of a field, place a colon followed by the name of the data type after the name of the field.
  • To indicate return type of method place a colon followed by the method name.
  • Parameters and their data types inside a method's parentheses.
  • The + (plus) sign in front of a member indicates that it is a public member.
  • The – (minus) sign indicates that it is a private member.
  • The # symbol before a member name indicates that it is a protected member.
In Section 6.3 we designed a Rectangle class. Following class diagram represent this.

Rectangle
- length : double
- width : double
+ Rectangle()
+ Rectangle(double, double)
+ set(double, double) : void
+ getArea() : double


No comments:

Post a Comment

Pages