attribute bug?
Jonathan M Davis
jmdavisProg at gmx.com
Sat Nov 10 01:34:52 PST 2012
On Saturday, November 10, 2012 08:28:00 goofwin wrote:
> I think that it is unsuccessful decision by the language
> designers, because object oriented code use virtual functions not
> much in most cases, thence it is useless and bad for performance
> or it causes developer to set public and protected functions as
> final explicitly very much.
Object-oriented code not use virtual functions much? If you don't need virtual
functions, then use a struct, not a class. Classes are polymorphic. Structs
are not. In general, it doesn't make a lot of sense to use a class in D if you
don't need polymorphism. And if you do need to but don't want the functions to
be virtual (e.g. you want to use a class, because you want a reference type
without going to the trouble of making a struct a reference type), then you
can just make all of the class' public functions final. But that's not the
normal case at all.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list