File size: 635 Bytes
f4952b6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | """Boxes, shutters and a grille: three constructors, three different shapes.
Box is the constructor the constructor-chain card of this bundle claims: it takes
self alone, names no base, and builds without opening the chain. Shutter already
opens the chain first, and Grille takes an argument the rule cannot forward.
"""
class Box:
def __init__(self):
self.sides = 4
self.closed = False
def area(self):
return self.sides * self.sides
class Shutter:
def __init__(self):
super().__init__()
self.open = False
class Grille:
def __init__(self, bars):
self.bars = bars
|