attribute bug?

goofwin artem.3a at gmail.com
Sat Nov 10 23:52:58 PST 2012


On Saturday, 10 November 2012 at 18:35:57 UTC, Jonathan M Davis 
wrote:
>
> 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

You didn't understand me. I mean that only less 30% of public 
functions in typical class must be virtual in most cases. And 
fact, that i need use 'final' for 70% public functions, is not 
comfortable. It is my humble opinion.

Sorry for my bad English.


More information about the Digitalmars-d-learn mailing list