Created: Feb, 2016
virtual void vfunc(int n);
pure virtual void vfunc(int n) = 0;
class Human
{
protected:
std::string name;
public:
Human(std::string name)
: name(name)
{
}
std::string get_name() { return name; }
virtual void hello() { std::cout << "Hello from a human!" << std::endl; }; // virtual function
virtual char* speak() = 0; // pure virtual function
};
Pure abstract class or interface class: an abstract class with pure virtual functions only.
A discussion on the scenario that an abstract class having (non-pure) virtual functions. Since the an abstract class cannot be instantiated anyway, the implementation inside virtual functions is useless (essentially like a pure virtual class).
This post explains it well.