How to create class objects in Python?



Not Found
404
Not Found

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
Updated on 20-Feb-2020 10:10:35

Advertisements