> From: Stephen McConnell [mailto:[EMAIL PROTECTED] > > What is interesting here is that ExcaliburComponentManager implements the > Initializable and Composable interfaces without declaring the required > exceptions and yet this compiles ok (which I confess I don't understand).
Stephen, it is a basic thing about OO programming - a subclass should be able to stand in for a superclass anywhere. That is, if SuperClass is a superclass to SubClass, then: void myMethod (SuperClass sc) { ... } ... myMethod (new SubClass ()); should be valid, as the contract for SuperClass is inherited down to SubClass. That is, SubClass must deliver at least as much as SuperClass. Proceeding with the notion of contracts - each class requires something and delivers something. This contract is inherited down the hierarchy, and a subclass must not require more and must not deliver less than a superclass. Thus, since Initializable can be seen as a superclass of ExcaliburComponentManager, ECM must not require more and must not deliver less than Initializable. Initializable has a method initialize () throws Exception. Requires: No parameters, ability for caller to handle Exception. Delivers: Initializes the class. Now, when ECM does *not* throw Exception: Requires: No parameters. Delivers: Initializes the class. So ECM actually requires *less* than Initializable. This is perfectly valid - the contract is upheld by the subclass. You class, however, does throw an Exception and thus requires *more* than its superclass (ECM). /LS -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>