Constructor-Destructor
Question 1 |
How constructor differ from destructor?
Constructors can be overloaded but destructors can’t be overloaded | |
Constructors can take arguments but destructor can’t | |
Constructors can be overloaded but destructors can’t be overloaded and Constructors can take arguments but destructor can’t
| |
None of the given options
|
Question 1 Explanation:
Constructors can be overloaded but destructors can’t be overloaded.
Destructors cant be overloaded because your code wouldn't have a clue about which destructor it needs to call when you destroy an object.
Destructors cant be overloaded because your code wouldn't have a clue about which destructor it needs to call when you destroy an object.