摘要:
虚函数使得在基类声明的函数能够在各个派生类里面重新定义。比如下面这个例子 1: #include <iostream> 2: #include <string> 3: using namespace std; 4: class Employee{ 5: string first_name, family_name; 6: short department; 7: public: 8: Employee(const string &n, int d); 9: virtual void print() const; 10: };... 阅读全文