Any way to override base type with dervived in derived type

Steven Schveighoffer schveiguy at yahoo.com
Fri May 25 10:45:23 UTC 2018


On 5/24/18 4:24 PM, IntegratedDimensions wrote:

> What I'd like to do is
> 
> class C : A
> {
>     private override @property TT t() { return cast(TT)(_t); } // null 
> check if necessary
>     // Stuff below uses t which is now a TT
>     ...
> }

It should work, you are allowed covariant overloads. However, private 
functions are not virtual, you need to make them at least protected.

-Steve


More information about the Digitalmars-d-learn mailing list