Thursday, June 18, 2009

Redefinition And Polymorphism

                     When a class is an heir of another it may need to change the implementation or other properties of some of the inherited features. A class session describing user sessions in an operating system may have a feature terminate to take care of cleanup operations at the end of a session.An heir might be remote session, handling sessions started from a different computer on a network.

               If the termination of a remote session requires supplementary actions, class remote session will redefine feature terminate.Redefinition may affect the implementation of a feature its signature and its specification.It should be possible to redefine the specification, signature and implementation of an inherited feature.


                   Polymorphism is the ability for an entity to become attached to objects of various possible types. In a statically typed environment, polymorphism will not be arbitrary but controlled by inheritance.for example,we should not allow our BOAT entity to become attached to an object representing an object of type BUOY, a class which does not inherit from BOAT.

            It should be possible to attach entities to run time objects of various possible types under the control of the inheritance based type system.An “entity” is a name to which various values may become attached at run time.This is a generalization of the traditional notion of variable.In object oriented computation,there is only one basic computational mechanism given a certain object which is always an instance of some class call a feature of that class on that object.

No comments:

Post a Comment