Virtual functions allow dynamic binding in C++ by allowing a function to be overridden in a derived class. A function is declared virtual by using the virtual keyword. At runtime, the compiler will call the version of a virtual function that is defined in the object's own class, rather than being bound at compile time like regular functions. This allows a base class pointer or reference to call a derived class implementation of a virtual function. Classes that contain virtual functions are called polymorphic classes.