forked from edyoda/python
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclasses-code.py
More file actions
Latest commit
37 lines (31 loc) · 556 Bytes
/
Copy pathclasses-code.py
File metadata and controls
37 lines (31 loc) · 556 Bytes
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
#Class is user defined data-type
#Creating an empty class
#Class doesn't occupy memory
'''
class Student:
pass
def __init__(self):
print 'Calling now'
#s1 is ab object of empty class
s1 = Student()
s1.name = "awantik"
print s1
s2 = Student()
print s2
s2.age = 99
print s1.__dict__
print s2.__dict__
'''
classStudent:
pass
def__init__(self,loc,age):
self.loc=loc
self.age=age
print'Calling now'
#s1 is ab object of empty class
s1=Student('Delhi',88)
prints1
s2=Student('Mumbai',99)
prints2
prints1.__dict__
prints2.__dict__