In computer science, polymorphism refers to the use of a single interface to represent multiple different types. This is one of the most important topics of object-oriented programming.
The point of polymorphism is that the rest of the code doesn’t need to know which derived class is being used (i.e., we may have a broad hierarchy but a function might be “common” for all classes). For virtual functions, what makes them useful is that if we call a method, it’ll automatically call the correct method.
A class with one or more pure virtual functions is called an abstract class, because objects of these classes cannot be instantiated. They’re also sometimes called interfaces, because they force derived classes to define the virtual function they inherit.
See also
- Virtual function, for implementation in C++