Thread overview | |||||
---|---|---|---|---|---|
|
August 28, 2005 Inherit from class template? | ||||
---|---|---|---|---|
| ||||
Why can I not inherit from a class template? I get an error saying the template can't be used as a type. For one thing, the error message is misleading, because you can use the template class as a type - to declare a variable of that type as well as use it in the new operator. What is the issue impeding using class templates as parent classes? Regards, James Dunne |
August 28, 2005 Re: Inherit from class template? | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | "James Dunne" <james.jdunne@gmail.com> wrote in message news:desvq8$12b6$1@digitaldaemon.com... > Why can I not inherit from a class template? I get an error saying the > template > can't be used as a type. > > For one thing, the error message is misleading, because you can use the > template > class as a type - to declare a variable of that type as well as use it in > the > new operator. > > What is the issue impeding using class templates as parent classes? > > Regards, > James Dunne Did you supply a template parameter? eg class Foo(T) {...} class Bar : Foo!(int) {...} class Baz(T) : Foo!(T) {...} |
August 28, 2005 Re: Inherit from class template? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | In article <det0er$133b$1@digitaldaemon.com>, Ben Hinkle says... > > >"James Dunne" <james.jdunne@gmail.com> wrote in message news:desvq8$12b6$1@digitaldaemon.com... >> Why can I not inherit from a class template? I get an error saying the >> template >> can't be used as a type. >> >> For one thing, the error message is misleading, because you can use the >> template >> class as a type - to declare a variable of that type as well as use it in >> the >> new operator. >> >> What is the issue impeding using class templates as parent classes? >> >> Regards, >> James Dunne > >Did you supply a template parameter? eg > class Foo(T) {...} > class Bar : Foo!(int) {...} > class Baz(T) : Foo!(T) {...} > Well, I'll be darned. I swear it was breaking, which was totally weird. But I try it again and it all works. I must've done something weird... I think I shall investigate further. Perhaps I've discovered some obscure special case. Thanks for making me check over my code, Ben! Regards, James Dunne |
Copyright © 1999-2021 by the D Language Foundation