Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+6 votes
asked in CSC201 Spring 2021 by (8 points)
0

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

4 Answers

+4 votes

The init method

answered by (8 points)
+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 (8 points)
+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 (8 points)
0 votes

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

answered by (8 points)
...