-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOop lec10.py
46 lines (39 loc) · 831 Bytes
/
Oop lec10.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
#Class and Object
'''
class human:
def __init__(self,name,age,gender):
self.name=name
self.age=age
self.gender=gender
def walk(self,a,b):
self.a=a
self.b=b
print("Point",self.a,"to B",self.b)
obj1=human("aman","15","male")
obj1.walk(20,50)
print(obj1.name)
print(obj1.gender)
'''
#__Init__ constructor
#self keyword
'''
class bird:
def __init__(self,name,color,size):
self.name=name
self.color=color
self.size=size
def quality(self):
print("I'm ",self.name)
print("my color is",self.color)
print("my size",self.size)
obj1=bird("crow","black","20")
obj1.quality()
'''
#without constructor
'''
class demo:
def withoutc(self):
print("something")
obj1=demo()
obj1.withoutc()
'''