Saved Bookmarks
| 1. |
What is the need of a constructor in OOP? Also write one feature of a constructor. |
|
Answer» 1. A special method member called the constructor method is used to initialize the data members of the class. Feature 2. The constructor has the same name as the class, has no return type, and may or may not have a parameter list. Or Whenever a new object of a class is created, the constructor of the class is invoked automatically |
|