Why private methods cant be virtual?

Steven Schveighoffer schveiguy at gmail.com
Tue Sep 22 12:30:25 UTC 2020


On 9/22/20 5:00 AM, claptrap wrote:
> IE the compiler is supposed to make methods non-virtual automatically, 
> it should be easy to do for private as all the relevant info be in the 
> one compilation unit.


class A
{
   private void foo() {}
}

class B(T) : A
{
    static if(T.stringof == "BlahBlahBlah") private override foo() {}
}

-Steve


More information about the Digitalmars-d-learn mailing list