Why private methods cant be virtual?

Steven Schveighoffer schveiguy at gmail.com
Tue Sep 22 14:19:09 UTC 2020

On 9/22/20 10:11 AM, Arafel wrote:

> My guess is that this was taken from Java, as in fact most of the D 
> class system seems to be (see `synchronized`, reference semantics, etc). 
> There it makes sense, because there is only one class per compilation 
> unit, so the `private` members are in effect hidden from any child 
> classes and it wouldn't make sense to override them.

This is a very good guess. Specifically, I think classes (and the 
mechanisms for inner classes and anonymous classes) were added to D1 to 
allow porting of JWT to D.


More information about the Digitalmars-d-learn mailing list