Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose class Base contains a function called void A(), which we would like to m

ID: 3919355 • Letter: S

Question

Suppose class Base contains a function called void A(), which we would like to modify, or override in a derived class, say class Derived. Which of the following must we do?                                                                                                                                                                                    (2 points)

A. Include void A(); (the function prototype) in the derived class definition and rewrite its definition outside using the scope resolution operator (void Derived :: A(){//New function definition}

B. Include void A(){//New function definition} in the derived class definition.

C. Both a. and b. will work

D. Include nothing in the derived class and rewrite the new definition outside using the scope resolution operator (void Derived :: A(){//New function definition}

E. We can’t override inherited functions

Answer: _____________

Explanation / Answer

Suppose class Base contains a function called void A(), which we would like to modify, or override in a derived class, say class Derived. Which of the following must we do.

Option c correct.