What is constructor and its types in Python?

Python Constructor. A constructor is a special type of method (function) which is used to initialize the instance members of the class . In C++ or Java, the constructor has the same name as its class, but it treats constructor differently in Python. It is used to create an object. Constructors can be of two types.

Sizin İçin Seçtik  How many class can you inherit?

Leave a Reply

Your email address will not be published. Required fields are marked *