I just noticed that I could have an implementation of a pure virtual function in the abstract class itself. GCC doesn't complain. Is there any use of such implementation? Can anybody use it?
class AbstractClass
{
virtual void PureVirtualFunction() = 0;
};
void AbstractClass::PureVirtualFunction() //Is there any use of this implementation?
{
cout << "I am inside pure virtual function of AbstractClass" << endl;
}
class DerivedClass : public AbstractClass
{
public:
void PureVirtualFunction();
};
void DerivedClass::PureVirtualFunction()
{
cout << "I am inside pure virtual function of DerivedClass" << endl;
}