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++?

  1. A.

    copy constructor

  2. B.

    conversion constructor

  3. C.

    overloaded constructor

  4. 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.

Explore the full course: Rssb Basic Computer Instructor