If depends on the declaration of the function and how you call the function.
Let BaseClass be the base class and DerivedClass is the derived class.
Then in the main function:
BaseClass b;
DerivedClass d;
b.f();
d.f();
Now if function f() is declared virtual in the base class then:
BaseClass b;
DerivedClass d;
b.f();
d.f();
BaseClass* bp;
bp = &b;
bp->f()
bp = &d;
bp->f();
This is basic c++ and any book should give you this information.
-Saurabh