Which of the following constructors is provided by the C++ compiler if not defined in a class?
Options
- A. Copy constructor
- B. Default constructor
- C. Parameterized constructor
- D. More than one of the above
- E. None of the above
Quiz Practice:
D. More than one of the above
Answer: (D) More than one of the above
If appropriate constructors are not declared by the programmer, the C++ compiler can implicitly provide certain constructors.
A default constructor may be implicitly declared when the class does not have a user-declared constructor. A copy constructor can also be implicitly declared when it has not been declared by the programmer, subject to the C++ language rules.
A parameterized constructor is not automatically created simply because it is not defined. Therefore, the correct answer for this question is More than one of the above.