Template bugged?

BCS ao at pathlink.com
Tue Sep 18 12:48:11 PDT 2007


Reply to Patrick,

> Ok i like C++ Template more :)
> 
> BCS schrieb:
> 
>> Reply to Patrick,
>> 
>> lets rearrange that a bit
>> 
>> class application(applogic)
>> {
>> this() { new applogic(); }
>> }
>> class HelloWorld2 : public application!(HelloWorld2)
>> {
>> }
>> int main() { new HelloWorld2(); }
>> 
>> now without the template stuff
>> 
>> class application(applogic)
>> {
>> this() { new HelloWorld2(); }
>> }
>> class HelloWorld2 : public application
>> {
>> //implict this() made explict
>> this(){super();}
>> }
>> int main() { new HelloWorld2(); }
>> 
>> new HelloWorld2 calls HelloWorld2.this HelloWorld2.this calls
>> application.this
>> application.this calls new HelloWorld2
>> loop
>> 

I think that would also fail in C++. If not, than the difference is not a 
template issue. The issue is that a class news an instance of it's self for 
each instance of it's self. It's just hidden by the use of template base 
classes





More information about the Digitalmars-d mailing list