Thread overview | |||||
---|---|---|---|---|---|
|
September 21, 2007 Re: class template as a type | ||||
---|---|---|---|---|
| ||||
Chris Nicholson-Sauls Wrote:
> Jarrett Billingsley wrote:
> > "Frits van Bommel" <fvbommel@REMwOVExCAPSs.nl> wrote in message news:fct4r0$hl9$1@digitalmars.com...
> >> Yes I did. I'm not quite sure how I managed to typo 'class' to 'function' though...
> >
> > It's understandable. The keys are right next to each other.
> >
> >
>
> You have a [class] key on your keyboard!? ...is that thing available on Amazon?
>
> -- Chris Nicholson-Sauls
Hehehehe. Guys, back into the subject. The only problem implementing a base class is that anyone can create a custom class inherited from the base class, override methods, skip all the base class constructors and then add it to an array or pass it to a function. Then there seems to be no way to check if this custom class implements the class template.
|
September 21, 2007 Re: class template as a type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Karl | Karl wrote:
> Chris Nicholson-Sauls Wrote:
>
>> Jarrett Billingsley wrote:
>>> "Frits van Bommel" <fvbommel@REMwOVExCAPSs.nl> wrote in message news:fct4r0$hl9$1@digitalmars.com...
>>>> Yes I did. I'm not quite sure how I managed to typo 'class' to 'function' though...
>>> It's understandable. The keys are right next to each other.
>>>
>>>
>> You have a [class] key on your keyboard!? ...is that thing available on Amazon?
>>
>> -- Chris Nicholson-Sauls
>
> Hehehehe. Guys, back into the subject. The only problem implementing a base class is that anyone can create a custom class inherited from the base class, override methods, skip all the base class constructors and then add it to an array or pass it to a function. Then there seems to be no way to check if this custom class implements the class template.
So you make the constructor(s) private and then only classes in the same module can inherit from it.
|
September 22, 2007 Re: class template as a type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frits van Bommel | Frits van Bommel Wrote:
> Karl wrote:
> > Chris Nicholson-Sauls Wrote:
> >
> >> Jarrett Billingsley wrote:
> >>> "Frits van Bommel" <fvbommel@REMwOVExCAPSs.nl> wrote in message news:fct4r0$hl9$1@digitalmars.com...
> >>>> Yes I did. I'm not quite sure how I managed to typo 'class' to 'function' though...
> >>> It's understandable. The keys are right next to each other.
> >>>
> >>>
> >> You have a [class] key on your keyboard!? ...is that thing available on Amazon?
> >>
> >> -- Chris Nicholson-Sauls
> >
> > Hehehehe. Guys, back into the subject. The only problem implementing a base class is that anyone can create a custom class inherited from the base class, override methods, skip all the base class constructors and then add it to an array or pass it to a function. Then there seems to be no way to check if this custom class implements the class template.
>
> So you make the constructor(s) private and then only classes in the same module can inherit from it.
WOW. Great idea, cool man, thanks for everything.
That surely will work, i don't know why i didn't think about that before...i guess i'm not smart enough.
|
Copyright © 1999-2021 by the D Language Foundation