Which of the following constructor-related concepts is non-relevant in C++?
2022
Which of the following constructor-related concepts is non-relevant in C++?
- A.
copy constructor
- B.
conversion constructor
- C.
overloaded constructor
- D.
virtual constructor
Attempted by 130 students.
Show answer & explanation
Correct answer: D
Copy constructor, conversion constructor, and overloaded constructor are all relevant constructor-related concepts in C++.
A copy constructor creates a new object as a copy of an existing object.
A conversion constructor allows an object to be created from a value of another type, enabling type conversion.
An overloaded constructor means a class can have multiple constructors with different parameter lists.
A virtual constructor is not supported in C++. Constructors are responsible for creating objects, so they cannot use virtual dispatch in the way virtual member functions do.
Therefore, the non-relevant constructor-related concept in C++ is virtual constructor.