A virtual method is a method that you should override when inheriting that class
It uses virtual as a keyword.
Virtual functions allow polymorphism. If a function is not declared virtual it will be impossible to override it in a child class. Example:
class Foobar
{
public:
};
class Foo: public Foobar
{
public:
};
class Bar: public Foobar
{
public:
};
void FoobarFunc(Foobar* fb)
{
}
void FooFunc(Foo* f)
{
}
When FoobarFunc is called with Foo, Bar, or Foobar, the line fb->FuncA() will call the the correct FuncA from each class according to polymorphism. However, in FoobarFunc, the line fb->FuncB() will ALWAYS call Foobar's FuncB no matter what type is actually passed in. To further illustrate this, in FooFunc, the line f->FuncB() will ALWAYS call Foo's FuncB.