www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Re: class template as a type

reply Karl <asd asdf.com> writes:
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.
Sep 21 2007
parent reply Frits van Bommel <fvbommel REMwOVExCAPSs.nl> writes:
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...


-- 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.
Sep 21 2007
parent Karl <asdf asdf.com> writes:
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...


-- 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.
Sep 21 2007