+ 1

Can someone explain about constructor

plz i want brief and clear explanation

28th Sep 2017, 3:27 AM
Abinesh N
Abinesh N - avatar
1 Resposta
+ 2
A constructor is a method within a class, which, as the base word "construct" define, is used to build an object from the said class. For example, if there is any member of the class needs value assignment this method is a good place to put such instructions, you can also design constructor method to create new instance with some default property values. A constructor method is usually named after the class in which it is defined, so if your class is dubbed "Student" usually the constructor also named "Student". A class can have multiple form by the help of polymorphism, it may accept different types of parameters, or number of parameters. Well, that's my opinion about a constructor, I maybe wrong, but just wanna share what I know. Hth, cmiiw
28th Sep 2017, 6:59 AM
Ipang