33 lines
740 B
Plaintext
33 lines
740 B
Plaintext
@startuml
|
|
|
|
package RealWorldExample{
|
|
abstract DrawingElement {
|
|
# name: string
|
|
+ DrawingElement(name: string)
|
|
|
|
+ virutal Add(DrawingElement)
|
|
+ virutal Remove(DrawingElement)
|
|
+ virutal Display(indent: int)
|
|
}
|
|
|
|
class PrimitiveElement extends DrawingElement{
|
|
+ PrimitiveElement(name: string)
|
|
+ Add(DrawingElement)
|
|
+ Remove(DrawingElement)
|
|
+ Display(indent: int)
|
|
}
|
|
|
|
class CompositeElement extends DrawingElement{
|
|
+ CompositeElement(name: string)
|
|
|
|
- elements: List<DrawingElement>
|
|
|
|
+ Add(DrawingElement)
|
|
+ Remove(DrawingElement)
|
|
+ Display(indent: int)
|
|
}
|
|
class Program
|
|
Program -l-> DrawingElement: " "
|
|
CompositeElement "1" o-l--- "*" PrimitiveElement: " "
|
|
}
|
|
@enduml |