How should overruling of overloaded functions work?

Søren J. Løvborg web at kwi.dk
Sun Aug 20 04:54:29 PDT 2006


This is the old problem of modifying the base class, while having the 
subclass continue to work as it should. It manifests itself in many ways.

The only way one can be sure to avoid this problem, is to never extend a 
class that one does not control -- i.e. classes defined in libraries etc.

If this rule is followed, there's indeed no reason for the current (C++ 
like) hiding of overloaded functions.

See for instance, "Why extends is evil" at JavaWorld, discussing the 
"fragile base-class" problem.
http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-toolbox.html

Quote:
> I once attended a Java user group meeting where James Gosling
> (Java's inventor) was the featured speaker. During the memorable
> Q&A session, someone asked him: "If you could do Java over again,
> what would you change?" "I'd leave out classes," he replied.

It's a controversial topic. :-)

Søren J. Løvborg
web at kwi.dk 





More information about the Digitalmars-d mailing list