What's the meaning of this constructor takes no arguments? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What's the meaning of this constructor takes no arguments?

11th Feb 2016, 5:18 PM
derick
derick - avatar
2 Answers
+ 1
It means that everytime an object of the class is created, the constructer is called. This constructor does not accept any variables or functions as its parameter. In layman's words, the constructor will have nothing inside its parentheses except for self keyword. Example: class my_class: def __init__(self): #constructor code goes here Here,the constructor __init__ takes no arguments. P.s refer stackoverflow.com for further doubts.
15th Apr 2016, 2:47 PM
Gururaj Chadaga
Gururaj Chadaga - avatar
0
#Great explanation
29th Jun 2016, 7:12 PM
Dumisani Moyo
Dumisani Moyo - avatar