A base class pointer can be used to point to an object of the base or any of its derived types. If the member function foo() is virtual then polymorphism allows this pointer to access the foo() of whatever class it is pointing to at runtime - here, the derived class.
If base::foo() hadn't been virtual then a base class pointer could only access the functions of the base class. (See what happens if you remove the word "virtual").
To use polymorphism like this (and get rid of compiler warnings) you should also make the base class's destructor virtual. Like so ... virtual ~Base(){}