Constructor is a member method of a class that is called when an instance of the class is declared.

Skill/Topic: Stacks using an Array
A) True
B) False
Explanation: A constructor is a member method of a class that is called when an instance of the class is declared. A destructor is a member method of a class that is called when the instance of the class falls out of scope.

Showing Answers 1 - 1 of 1 Answers

samiksc

  • Jan 19th, 2006
 

For some prog languages like C# : False -- to be specific a constructor is called when an instance of a class is initialized. In C# declaration A obj; does not call the constructor. A statement like A obj = new A(); calls the constructor.

For C++: true: When you declare an instance like A obj; the object is constructed using the constructor.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions