-
Notifications
You must be signed in to change notification settings - Fork 0
/
class.py
52 lines (43 loc) · 1003 Bytes
/
class.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
class Hello:
people = 0
age_increase = 1
def __init__(self,name,age):
self.name = name
self.age = age
self.email = name + str(age) + "@email.com"
Hello.people += 1
def ageincrease(self):
self.age = self.age + Hello.age_increase
@classmethod
def increase_age(cls,increament):
cls.age_increase = increament
@classmethod
def from_str(cls,emp_string):
name,age = emp_string.split("-")
return cls(name,age)
@staticmethod
def statfunction(day):
if day == 'sunday'.upper() or day == 'sunday':
return False
else:
return True
class Gender(Hello):
def __init__(self,name,age,g,exp):
super().__init__(name,age)
self.g = g
self.exp = exp
if __name__ == ' __main__':
j = Hello('John',20)
k = Hello('Ken',30)
print(j.email)
#print(j.age)
#j.ageincrease()
#print(j.age)
#j.increase_age(3)
#j.ageincrease()
#print(j.age)
#y = "Jon-65"
#x = Hello.from_str('John-5')
#print(Hello.from_str('Hello '))
#print(x.name,x.age)
#print(j.statfunction('sunday'))