class base {
public:
int foo();
int foo(int a);
int foo(char* b);
int doSomething(int);
}
class derived : public base
{
public:
int doSomething(int b);
}
int derived::doSomething( int b)
{
base::doSomething(b);
//Make Something else
}
int main()
{
derived d= new derived();
d->foo();
}
now in the foo method (any of them) i want to call the more specific doSomething. if i instance a derived class i want the doSomething of the derived class, and if i instance a base class i want the doSomething of the base class, in spite of i'm calling from the foo method implemented in the base class.
int base::foo()
{
//do something
makeSomething(5);
}