Constructor in a Function
constructor in function init function is a built in function in Python and it's in the constructor of
the class constructor is called whenever a new object of the class is created.
And it should be called only during creating the object so promotor in the inner function refers to
that instance for the object itself.
And it's important to use it if you want to use a constructor in your class.
Let's see how.
OK.
First go to.
As you can see we have a class person.
Now I will show you how to use the constructor of the class type.
Def underscore underscore enet underscore underscore parenthesis self name age ID number call an event
self that name equal name cells that age equal age so the ID number equal ID number or ID number whatever
next type or output function.
Ok now we are in the meaning of the program to use the constructor of the class create an object such
as Jonni or person parenthesis quotation marks.
John 33 on put the ID numbers.
All right so doing creating the object we passed the arguments to the constructor of the class
then type John the output function after that.
Try that on terminal.
Really nice.
The constructor of the class works well.
Thank you for watching.