| 
      
        
         2D Shapes System 
          
          
          
          
          
          
          
          
          
          
          
          
          
          
           [Previous]   [Next]    
     | 
    ![]()  | 
      
                 User Manual [Previous]  [Next] 2D Shapes System
 Example
// 2D Shapes class hierarchy - sample UML class
// diagram in Umple
// From Book by Lethbridge and Laganiere, McGraw Hill 2004
// Object-Oriented Software Engineering:
//   Practical Software Engineering using UML and Java
// See https://www.site.uottawa.ca/school/research/lloseng/
//Namespace for core of the system.
namespace Shapes.core;
class Shape2D {
 center;
}
//Abstract
class EllipticalShape {
 isA Shape2D;
 semiMajorAxis;
}
//Abstract
class Polygon { 
 isA Shape2D;
}
class Circle {
 isA EllipticalShape;
}
class Ellipse{
 isA EllipticalShape;
}
class SimplePolygon {
 orientation;
 isA Polygon;
}
class ArbitraryPolygon {
 points;
 isA Polygon;
}
class Rectangle {
 isA SimplePolygon;
 height;
 width;
}
class RegularPolygon {
 numPoints;
 radius;
 isA SimplePolygon;
}
class Shape2D {
  public static void main(String [] argc) Java {
    Shape2D s = new
      RegularPolygon("0,0","0","3","100");
    System.out.println(s);
  }
  public static void main(String [] argc) Python{
    import RegularPolygon
    s = RegularPolygon.RegularPolygon("0,0","0","3","100")
    print(str(s))
  }
}
      
Load the above code into UmpleOnline  |