deadalnix wrote:
It looks like a bad usage of inheritance. If you want to use these methods, why not use composition ?

It make no sense to use such an inherited class in a polymorphic context, so why use inheritance at all ?

Am I missing something about what you're saying? Having a final
class is completely different than locking up it's functions:

   abstruct class Actor
   {
     void create() {}
     void update() {}
   }

   class Ship : Actor
   {
     final void create() {}
     final void update() {}
     final void fire() {}
   }

   class MotherShip : Ship
   {
     final void fireMissle() {}
   }

   void main() {
     Actor[] actors = [
         new Ship();
         new MotherShip();
       ];

     foreach (actor; actors) {
       actor.fire();
     }
   }

If Ship was final simply because all it's methods where, then you
couldn't inherit it's functionality into MotherShip.


Reply via email to