Is it allowed to have the definition of a purely virtual method as follows?
class Abstract {
public:
   virtual void pureVirtual() = 0 {
      // implementation
   }
};
Explanation
ISO 14882:2003
10.4 Abstract classes
2    ...[Note: a function declaration cannot provide both a pure-specifier and a definition
—end note] [Example:
struct C {
	virtual void f() = 0 { }; // ill-formed
};
—end example] It should be noted that the definition itself is allowed, the standard only prohibits declaring a purely virtual function in the body.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes