Hello All,
I'm new to C++ (been an Ada guy for over 20 years), and I've search but can't find an answer to my question on the Web (big place!), so I'm hoping you Gurus come help me.
I know that for virtual functions, if you declare it with an "= 0" (pure virtual) it not only designates the base class as an "abstract class", but also forces the derived class to define an implementation.
Is there a way to do this for variables? What I really want is something like (not 100% on syntax, so please forgive):
class Base
{
public:
virtual void dummyMakeMeAbst ract() = 0; // don't allow instantiations
protected:
virtual const static typeXXX mustOverrideVar iable;
}
class Derived : public Base
{
public:
void dummyMakeMeAbst ract(){};
protected:
const static typeXXX mustOverrideVar iable = myValue;
}
I could live without the const static behavior if I had to.
Thanks in advance !!!
I'm new to C++ (been an Ada guy for over 20 years), and I've search but can't find an answer to my question on the Web (big place!), so I'm hoping you Gurus come help me.
I know that for virtual functions, if you declare it with an "= 0" (pure virtual) it not only designates the base class as an "abstract class", but also forces the derived class to define an implementation.
Is there a way to do this for variables? What I really want is something like (not 100% on syntax, so please forgive):
class Base
{
public:
virtual void dummyMakeMeAbst ract() = 0; // don't allow instantiations
protected:
virtual const static typeXXX mustOverrideVar iable;
}
class Derived : public Base
{
public:
void dummyMakeMeAbst ract(){};
protected:
const static typeXXX mustOverrideVar iable = myValue;
}
I could live without the const static behavior if I had to.
Thanks in advance !!!
Comment