概念
微软官方文档介绍: A virtual function is a member function that you expect to be redefined in derived classes.When you refer to a derived class object using a pointer or a reference to the base class, you can call a virtual function for that object and execute the derived class’s version of the function.
本质上,虚函数是成员函数的一种。它主要应用在多态的场景。它是为了我们能够在定义子类时可以重载从父类继承过来的成员函数(即虚函数)。如果不需要重载,我们也可以直接调用执行它,把它当作普通的成员函数。