CPA-21-02 practice question 33 of 35
What is not inherited from the base class?
Full set: 257 questionsAccording to the C++ Standard, derived classes inherit all members of the base class with specific exceptions: constructors, destructors, and copy/move assignment operators are not inherited. While C++11 introduced the ability to explicitly inherit constructors via the using declaration, they are not inherited by default. Destructors are never inherited, as each class has its own specific cleanup requirements. Similarly, copy and move assignment operators (operator=) are not inherited because the compiler implicitly declares them for the derived class, which hides the base class versions.
D: Incorrect because operator+() (and other general overloaded operators) are standard member functions and are normally inherited by derived classes without issue.
1. ISO/IEC 14882:2017 Standard, Section 13.2 [class.derived] paragraph 3 ("Constructors, destructors, and copy assignment operators are not inherited").
2. MIT OpenCourseWare, 6.096 Introduction to C++, Lecture 8 (Inheritance and Polymorphism).
Keep practicing
Take the free CPA-21-02 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other CPA-21-02 practice questions
- Question 1What happens when you attempt to compile and run the following code? #include using names…
- Question 2What happens when you attempt to compile and run the following code? #include #include us…
- Question 3Which of the following statements are correct about an array? int tab[10];
- Question 4What happens when you attempt to compile and run the following code? #include #include us…
- Question 5What is the output of the program if characters 'h', 'e', 'l', 'l' , 'o' and enter are su…
- Question 6What happens when you attempt to compile and run the following code? #include using names…
