Home > Back-end >  Of new, C inheritance and derived don't understand, don't know what this code means, ask b
Of new, C inheritance and derived don't understand, don't know what this code means, ask b

Time:10-14

Strives for the brothers and sisters, and he a little look not to understand ah, I also want to hand in your homework

CodePudding user response:

Multiple inheritance, the name of two parent function
So either in subclasses override show method, which is either explicitly parent show method, namely the SW. The show () to SW. Car: : show () or to SW. Wagon: : show ()

CodePudding user response:

A virtual function if rewriting the function can cause ambiguity, even if you generated is a derived class, if using a base class pointer is access to the base class, derived class pointer is access to the derived class function, virtual function won't have this problem,
  • Related