C++ Programming - Constructors and Destructors - Discussion

Discussion Forum : Constructors and Destructors - General Questions (Q.No. 2)
2.
What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor?
Compile-time error.
Preprocessing error.
Runtime error.
Runtime exception.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
22 comments Page 3 of 3.

Lalit said:   1 decade ago
Because, when we build an object, then the constructor is call.

Kavita said:   1 decade ago
Constructor errors are always genrated at compile time. If we write a constructor, then compiler only deals with that constructor, not go for default constructor. So wehen we create a object having no parameter. It generates error.


Post your comments here:

Your comments will be displayed after verification.