www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - 'override' question

reply kris <foo bar.com> writes:
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
parent Sean Kelly <sean f4.ca> writes:
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