On Thursday, May 10, 2018 11:52:38 Piotr Mitana via Digitalmars-d-learn wrote: > Given this code: > > abstract class A > { > package @property void x(int x); > package @property int x(); > } > > class B : A > { > package @property override void x(int x) {} > package @property override int x() { return 0; } > } > > void main() {} > > I get the following message: > > onlineapp.d(9): Error: function `onlineapp.B.x` package method is > not virtual and cannot override > onlineapp.d(10): Error: function `onlineapp.B.x` package method > is not virtual and cannot override > > Why is that? If the access specifier is private, I can perfectly > understand it - subclasses can't call the private method of > parent class, so there's no need in making it virtual. For > protected/public the code compiles. However, for the package > protection it may happen that a subclass is in the same package > (and just happened to me). > > Should I file a bug or is there a reason for such behavior?
I don't rememeber the reasoning at the moment, but it's most definitely not a bug and is on purpose. There's probably a "won't fix" bug in bugzilla for it if you go digging. - Jonathan M Davis