0
What is constructor?
1 Answer
+ 1
It is a method invoked during the object instantiation (creation); as the name suggests it is involved with object construction. Simple use is when we need to initialize some attributes of the object, so it make more sense. Example: We want to avoid someone to initialize an object of type/class Person without the person name (another programmer could forget it; causing future problems).