Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
December 26, 2010 subclassing templated class | ||||
---|---|---|---|---|
| ||||
Hello, If I have class Node (Element) {...} can I subtype it like with class Leaf (Element) : Node (Element) {...} or such? Denis -- -- -- -- -- -- -- vit esse estrany ☣ spir.wikidot.com |
December 26, 2010 Re: subclassing templated class | ||||
---|---|---|---|---|
| ||||
Posted in reply to spir | spir <denis.spir@gmail.com> wrote: > Hello, > > If I have > class Node (Element) {...} > can I subtype it like with > class Leaf (Element) : Node (Element) {...} > or such? Yes. -- Simen |
December 26, 2010 Re: subclassing templated class | ||||
---|---|---|---|---|
| ||||
Posted in reply to spir | On 12/26/2010 05:47 PM, spir wrote:
> Hello,
>
> If I have
> class Node (Element) {...}
> can I subtype it like with
> class Leaf (Element) : Node (Element) {...}
> or such?
>
> Denis
Absolutely:
class Leaf(Element) : Node!Element {...}
|
December 26, 2010 Re: subclassing templated class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stanislav Blinov | Stanislav Blinov <stanislav.blinov@gmail.com> wrote: > On 12/26/2010 05:47 PM, spir wrote: >> Hello, >> >> If I have >> class Node (Element) {...} >> can I subtype it like with >> class Leaf (Element) : Node (Element) {...} >> or such? >> >> Denis > > Absolutely: > > class Leaf(Element) : Node!Element {...} You're right. I did not notice the lack of an exclamation mark. -- Simen |
December 26, 2010 Re: subclassing templated class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stanislav Blinov | On Sun, 26 Dec 2010 17:54:22 +0300
Stanislav Blinov <stanislav.blinov@gmail.com> wrote:
> > Hello,
> >
> > If I have
> > class Node (Element) {...}
> > can I subtype it like with
> > class Leaf (Element) : Node (Element) {...}
> > or such?
> >
> > Denis
>
> Absolutely:
>
> class Leaf(Element) : Node!Element {...}
Thank you! That's the syntactic bit I was missing. Logical, indeed...
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
|
Copyright © 1999-2021 by the D Language Foundation