How to create class objects in Python?



A class object is created using the constructor of the class. This object is then called the instance of the class. Class instantiation uses function notation. 

In the following code we define a class and created an instance of the same class as follows

>>> class Myclass:
pass
>>> x = Myclass()
>>> print x
<__main__.Myclass instance at 0x00000000062F85C8>

raja
Published on 12-Jan-2018 11:05:06
Advertisements