Calling a overrided function from a base function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've got MyClassA superclass for MyClassB.
In MyClassA there're 2 function f1 and f2. f2 is called from f1.
MyClassB specialize MyClassA and, overrides the f2 function.
when in MyClassB i call f1 function (base), the f1 function call the base f2
or the overrided f2?
I don't need to override f1 function.

Thanks
 
...
I've got MyClassA superclass for MyClassB.
In MyClassA there're 2 function f1 and f2.
f2 is called from f1.
MyClassB specialize MyClassA and, overrides the f2 function.
when in MyClassB i call f1 function (base),
the f1 function call the base f2
or the overrided f2?

If it's *truly* overridden (using the keywords 'virtual' and 'override') it
will be the f2 in MyClassB.

If it doesn't use 'virtual' in the superclass, and 'override' in the
subclass, it will be the f2 in MyClassA.

// Bjorn A
 
Back
Top