On Wednesday, 13 June 2012 at 22:48:34 UTC, Jonathan M Davis
wrote:
On Thursday, June 14, 2012 00:32:45 BLM768 wrote:
For some reason, whenever I declare a method with package
visibility, it becomes non-virtual. Is this normal behavior, or
is there a bug in DMD 2.059?
Only public and protected functions can be virtual. private and
package
functions are never virtual. This is by design.
- Jonathan M Davis
That explains it. I kind of wish I'd known that a few hours ago :)
It would be nice if DMD would issue a warning when redefining a
non-virtual function in a subclass. I might have to start using
"override" more often despite force of habit and dislike of its
verboseness. Perhaps "override" should be implied by default
since it's by far the most common case. In cases where the
programmer really wants to redefine the function non-virtually,
there could be a keyword that would handle that. It could reduce
extra typing and save beginners hours of stress :)