Revision b61189a50728b0bd893242eec4defbe2253bd5fe (click the page title to view the current version)

Exercise 1 solution using inheritance

abstract Lamp
xor shape
ball
square
diamond
TrafficLightSystem
Lamps
Red : Lamp
[ no diamond ]
Yellow : Lamp
[ no square ]
Green : Lamp
[ ball ]
allBalls ?
[ all l : Lamp | l.shape.ball ]
xor orientation
vertical
horizontal

Back to country specific features