On Freitag, 28. Juni 2013 11:50:13 CEST, Pali Rohár wrote:

In interface are virtual pure functions. So then remove protected constructor (and compiler will generate one default)?


If you can compile this, you'll be my hero ;-)

------ snip  ------------

class Pure {
public:
   virtual void foo() = 0;
};

class Tainted : Pure {
public:
   Tainted() : Pure(), bar(5) { };
   void foo() { bar *= 2; }
   int bar;
};


int main(int argc, char **argv)
{
   Pure pure;
   Tainted tainted;
}

------ /snip  ------------

Commenting "// Pure pure;" is not an acceptable trick ;-P

IOW: it doesn't matter whether a Clas with pure virtuals has a constructor - 
you cannot use it anyway.

Cheers,
Thomas

Reply via email to