digitalmars.D - 'override' question
- kris (12/12) Feb 05 2007 given a base class with method write():
- Sean Kelly (6/23) Feb 06 2007 Good question :-) I'd say it should print "base" but a subclass of Sub
given a base class with method write(): And subclass Sub with method write(): What should happen (a) at compile time, and (b) at runtime when invoking Sub.func?
Feb 05 2007
kris wrote:given a base class with method write(): And subclass Sub with method write(): What should happen (a) at compile time, and (b) at runtime when invoking Sub.func?Good question :-) I'd say it should print "base" but a subclass of Sub gets another chance to override write() since it can't see Sub.write(). It would make more sense if it were an error to have a private override method. Sean
Feb 06 2007