Calling a overrided function from a base function

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
 
B

Bjorn Abelli

...
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top