[Zope3-dev] I've changed my mind about inheritence of interface declarations

Shane Hathaway shane@zope.com
Wed, 12 Mar 2003 12:18:21 -0500


Barry A. Warsaw wrote:
>>>>>>"JF" == Jim Fulton <jim@zope.com> writes:
>>>>>
> 
>     JF> (The situation with subclassing would be better if we had an
>     JF> explicit way to declare subclassing contracts that spelled out
>     JF> the promises made to and demanded of subclasses.)
> 
> Classes that are intended to act as base classes should be designed
> that way, which means specifying a formal interface for its derived
> classes.  E.g. Something like C++'s protected methods.

I think Stroustrup would think along those lines.  In C++, virtual 
methods are safe to override, while non-virtual methods aren't 
necessarily safe (you can do it, but you might not get what you 
expected).  And Java has "final" methods (which you can't override). 
Python has no way to declare anything similar.

Shane