From: Me [mailto:[EMAIL PROTECTED]] > > > The problem I see with inheriting subblocks such as > > FIRST/LAST/etc, is that they are tied in with the logic > > ... of their enclosing block... > > Surely this is an argument *for* it being pretty odd > *not* to inherit them. > > Let's say you add a LAST block to a method. In the > LAST block you write clean up code that frees some > resources. If you inherit from that method, and do not > inherit the LAST block, then you've got a leak. This is > obviously a mild example.
Methods can be inherited. Their implementations may include LAST blocks, which will be invoked along with the inherited method if the method is not redefined in a subclass. However, if the method is redefined in a subclass, neither the superclass' method's implementation or its associated LAST block would be invoked. In contrast, pre- and post-conditions _are_ inherited and separate from the method implementation itself. If an inherited method is redefined in a subclass, it must still satisfy pre- and post-conditions.