But it translates VS2011 without errors...
So, everywhere, when i can use virtual/abstract function i must get the equating to zero, why is that? What be done, when i won't use this equating? I mean just use
Not sure if I understood that, so you can make a function purely virtual which prevents the instantiation of the base class, but you can still call it from a derived class or what? Otherwise I wouldn't see any point in providing a definition for an abstract function.
If you give a definition, you cannot instantiate the class, as per a normal pure virtual function. Basically all it does is let you possibly define some common functionality that derived classes might want.
class Base
{
public:
virtualvoid VFuncA()=0;
int x;
};
//Give the pure virtual function a body
void Base::VFuncA()
{
x =3;
}
class Derived: public Base
{
public:
void VFuncA()
{
Base::VFuncA();//calls bas class version
}
};
int _tmain(int argc, _TCHAR* argv[])
{
//Base *pb = new Base;//Error base class is abstract
Base *pb = new Derived;
pb->VFuncA();
delete pb;
return 0;
}