-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathmain.py
54 lines (34 loc) · 955 Bytes
/
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
54
from abc import ABCMeta, abstractmethod
class Theme(metaclass=ABCMeta):
@abstractmethod
def color(self):
pass
class DarkTheme(Theme):
def color(self):
return 'Dark Black'
class LightTheme(Theme):
def color(self):
return 'Off White'
class AquaTheme(Theme):
def color(self):
return 'Light Blue'
class WebPage(metaclass=ABCMeta):
@abstractmethod
def content(self):
pass
class About(WebPage):
def __init__(self, theme):
self.__theme = theme
def content(self):
return f'About page in {self.__theme.color()}'
class Careers(WebPage):
def __init__(self, theme):
self.__theme = theme
def content(self):
return f'Careers page in {self.__theme.color()}'
if __name__ == '__main__':
dark_theme = DarkTheme()
about = About(dark_theme)
careers = Careers(dark_theme)
print(about.content())
print(careers.content())