On Friday 28 June 2013 14:20:34 Thomas Lübking wrote:
> 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,
> ThomasI know, so I'm asking if I should remove constructor (and compiler will generate one without parent qobject paremeter) or move it to public section? -- Pali Rohár [email protected]
signature.asc
Description: This is a digitally signed message part.
