-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpessoa.py
More file actions
53 lines (38 loc) · 1.04 KB
/
pessoa.py
File metadata and controls
53 lines (38 loc) · 1.04 KB
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
import abc;
__author__ = 'Bruno'
class Person(object):
__metaclass__ = abc.ABCMeta
def __init__(self):
"""Constructor"""
self.name = ""
@abc.abstractmethod
def say_hello(self):
"""
Say hello
"""
raise NotImplementedError
class Employee(Person):
def say_hello(self):
"""
An employee hello
"""
print("Hi, my name is " + self.name + " . How can I help you?")
class Customer(Person):
def say_hello(self):
"""
An customer hello
"""
print("Hi, my name is " + self.name + " . I need someone help!")
class IPersonFactory(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def build_person(self, person_type):
"""Build a person"""
raise NotImplementedError
class PersonFactory(IPersonFactory):
def build_person(self, person_type):
"""Build a person"""
if person_type.lower() == "customer":
return Customer()
else:
return Employee()