Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+7 votes
asked in CSC201 Spring 2021 by (1 point)
0

One example of a constructor is init() method to initialize instance variables.

4 Answers

+4 votes

The init method

answered by (1 point)
+3 votes

Constructors are generally used for instantiating an object. The task of constructors is to initialize(assign values) to the data members of the class when an object of the class is created the init() method is called the but i guess there are two types of constructors te default one, and the parameterized one.
https://www.geeksforgeeks.org/constructors-in-python/
check this link if u want more details

answered by (1 point)
+1 vote

Constructors are for instantiating an object.The task of constructors is to initialize the data members of the class when an object of class is created. The init() method is called the constructor in Python and is always called when an object is created.

answered by (1 point)
0 votes

One example of a constructor is init() method to initialize instance variables.

answered by (1 point)
...