This is one of those areas where abstract examples really make learning a concept much more difficult, then if they provide real world, not completely contrived examples.
You would use a pointer to a base class if you wanted to treat a number of different, but similar objects in the same manner. Chapter 4 of my C++ game tutorial illustrates the use of virtuals in a real world example.
In a nutshell though, it does something like this ( brutal pseudo code... follow the tutorial if you want to see the full thing ):
Code:
struct GameObject {};
struct Player : GameObject {};
struct Enemy : GameObjecy{};
vector <GameObjects*> theWorld;
main()
{
vector<GameObject*> theWorld;
theWorld.push_back(new Player("Me"));
theWorld.push_back(new Player("You"));
theWorld.push_back(new Enemy("Them"));
foreach(Gameobject * obj in theWorld)
{
obj->doSomething();
}
}
In this example, other than constructor invocation you are only dealing with pointers to the base class. This allows you to store the different, but similar Player and Enemy classes in the same structure and use the same code.
By the nature of being a pointer to a virtual method "doSomething", it will call up the function chain to the most inherited implementation. Therefore if Player overrode GameObjects do something, if the GameObject pointer points to a Player object, it will be the Player objects overriden version of doSomething() that will be invoked, not GameObject's.
If however doSomething() wasn't a virtual method ( but both GameObject and Player had a matching doSomething() method ), the type of the pointer itself would determine which method would be invoked.
Clear as mud? If not, just click the link and see real world example that is explained a whole lot better!