神武 2017天策 攻略:虚函数是什么?

来源:百度文库 编辑:中科新闻网 时间:2024/05/10 07:52:18
实现机制,作用

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.

就是如果你想用这个函数就必须自己实现!由系统调用!