函数体=0的虚函数称为“纯虚函数”.包含纯虚函数的类称为“抽象类” #include <string> class Animal // This Animal is an abstract base class { protected: std::string m_name; public: Animal(std::string name) : m_name(name) { } std::string getName() { return m_name; } ; // note that sp…
原文地址:http://en.wikipedia.org/wiki/Virtual_function In object-oriented programming, a virtual function or virtual method is a function or method whose behavior can be overridden within an inheriting class by a function with the same signature. This co…
An abstract function has to be overridden while a virtual function may be overridden. Virtual functions can have a default /generic implementation in the base class. An abstract function can have no functionality. You're basically saying, any child c…