-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
53 lines (47 loc) · 1.06 KB
/
main.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from component import Component
'''
Hierarchy:
Saul
Alex
Alice
Bob
Carlos
Amy
Bella
Brooke
Abigail
Brandon
Caleb
Daniel
Evelyn
Freya
Faye
'''
# Declare components
faye = Component('Faye')
freya = Component('Freya')
evelyn = Component('Evelyn')
daniel = Component('Daniel')
caleb = Component('Caleb')
brandon = Component('Brandon')
abigail = Component('Abigail')
brooke = Component('Brooke')
bella = Component('Bella')
amy = Component('Amy')
carlos = Component('Carlos')
bob = Component('Bob')
alice = Component('Alice')
alex = Component('Alex')
saul = Component('Saul')
# Create hierarchy
evelyn.add_children([freya, faye])
daniel.add_child(evelyn)
caleb.add_child(daniel)
brandon.add_child(caleb)
abigail.add_child(brandon)
amy.add_children([bella, brooke])
bob.add_child(carlos)
alice.add_child(bob)
saul.add_children([alex, alice, amy, abigail])
# call a method that will be called for all children
saul.greet('Jake')