How do you implement this Python idiom in C++
Jon Clements
joncle at googlemail.com
Thu Jul 27 12:11:26 EDT 2006
alainpoint at yahoo.fr wrote:
> // Curious class definitions
> class CountedClass : public Counted<CountedClass> {};
> class CountedClass2 : public Counted<CountedClass2> {};
>
> It apparently works but in fact it doesn't:
> If you derive from such a class, you get the count of the parent class,
>
> not of the derived class.
> class CountedClass3 : public CountedClass {};
>
Hint: where's the template parameter gone as per the previous two
statements...
Jon.
More information about the Python-list
mailing list