Identify the correct statements. (i) Derived classes do not inherit or…
2018
Identify the correct statements.
(i) Derived classes do not inherit or overload constructors or destructors from their base classes.
(ii) Destructors can be declared with the keyword virtual.
(iii) Constructors can be declared with the keyword virtual.
- A.
(i) and (iii) only
- B.
(i) and (ii) only
- C.
(ii) and (iii) only
- D.
(i), (ii) and (iii)
Attempted by 100 students.
Show answer & explanation
Correct answer: B
In C++, constructors and destructors are not inherited members, confirming statement (i). Destructors can be declared virtual to ensure proper resource cleanup during polymorphic deletion, supporting statement (ii). Conversely, constructors cannot be virtual, making statement (iii) incorrect. Thus, the valid statements are only (i) and (ii).