D - bug in template subclasses
- Daniel Yokomiso (24/24) Dec 02 2002 Hi,
- Walter (3/27) Dec 03 2002 Ok, I see what's going wrong. Thanks, -Walter
Hi,
The following code doesn't compile.
template A(T) {
public interface I {
public T i();
}
}
class B : instance A(int).I {
public int i() {
return 42;
}
}
int main() {
B b = new B();
instance A(int).I i = b;
printf("B.i -> %d\r\n", b.i());
printf("I.i -> %d\r\n", i.i());
return 0;
}
The inheritance declaration of B doesn't accept a anonymous template
instance, but accepts a qualified one.
Best regards,
Daniel Yokomiso.
"Alcohol & calculus don't mix. Never drink and derive."
Dec 02 2002
Ok, I see what's going wrong. Thanks, -Walter
"Daniel Yokomiso" <daniel_yokomiso yahoo.com.br> wrote in message
news:asgbf3$2uov$1 digitaldaemon.com...
Hi,
The following code doesn't compile.
template A(T) {
public interface I {
public T i();
}
}
class B : instance A(int).I {
public int i() {
return 42;
}
}
int main() {
B b = new B();
instance A(int).I i = b;
printf("B.i -> %d\r\n", b.i());
printf("I.i -> %d\r\n", i.i());
return 0;
}
The inheritance declaration of B doesn't accept a anonymous template
instance, but accepts a qualified one.
Best regards,
Daniel Yokomiso.
"Alcohol & calculus don't mix. Never drink and derive."
Dec 03 2002








"Walter" <walter digitalmars.com>