-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.py
38 lines (33 loc) · 936 Bytes
/
model.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
from abc import ABC, abstractmethod
from address import Address
class Person(ABC):
def __init__(self, p_id=0, name=None, cnic=None):
self.p_id = p_id
self.name = name
self.cnic = cnic
self.fullAddress = Address()
# p_id property
@property
def p_id(self):
return self.__p_id
@p_id.setter
def p_id(self, value):
# if value is None:
# raise AttributeError("Can't set id attribute")
if value > 100 or value < 0:
raise AttributeError("The value is invalid!")
self.__p_id = value
# name property
@property
def name(self):
return self.__name
@name.setter
def name(self, value):
self.__name = value
# cnic property
@property
def cnic(self):
return self.__cnic
@cnic.setter
def cnic(self, value):
self.__cnic = value