0

Constructors

what is the use of constructor in simple words

24th Sep 2018, 12:38 AM
Kabir Solanki
Kabir Solanki - avatar
2 Answers
+ 3
It creates an instance of the object when called. It can be called by simply assigning it to a variable. imagine you have an object Circle you can instantiate it by: Circle C1; or if you have parameters to create an object with different properties like the radius on the circle: Circle C1(0.5);
24th Sep 2018, 12:54 AM
Justin Petluk
Justin Petluk - avatar
+ 4
Constructor is creating the similar words
25th Aug 2021, 2:20 PM
Kedar
Kedar - avatar