Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathclasses.py
More file actions
Latest commit
98 lines (44 loc) · 1 KB
/
Copy pathclasses.py
File metadata and controls
98 lines (44 loc) · 1 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
classClassName:
'Optional description'
var1=0
def__init__(self, name, id):
self.name=name
self.id=id
defmethod1(self):
print'this is method 1'
obj1=ClassName("ABC", 2)
obj1.method1()
printClassName.var1
obj1.age=4
obj1.address='street'
delobj1.age
delClassName.var1
print (hasattr(obj1, 'age'))
printgetattr(obj1, 'address')
setattr(obj1, 'age', 'xyz')
delattr(obj1, 'age')
print (hasattr(obj1, 'age'))
printClassName.__doc__
printClassName.__name__
printClassName.__bases__
printClassName.__dict__
printClassName.__module__
classChildClass (ClassName):
'Inheriting class ClassName'
var2=5
__secretNum=6
def__init__(self):
print' this is child class constructor'
defmethod2(self, name):
printname
defmethod1(self):
print'this is child class method1'
c=ChildClass()
c.method2("XYZ")
c.method1()
printc._ChildClass__secretNum
classVehicle :
defcalcSpeed(self) :
print'hi'
c=Vehicle()
c.calcSpeed()