35.creating Our First Class in Python
35.creating Our First Class in Python
Creating Object:
Creating an object of a class is rather easy and
simple. Suppose we have a class named Student. We can
create an object of it by these certain lines of code:
Stu1 = Student()
Stu2 = Student()
An object consists of :
harry = Student()
larry = Student()
harry.name = "Harry"
harry.std = 12
harry.section = 1
larry.std = 9
larry.subjects = ["hindi", "physics"]
print(harry.section, larry.subjects)