Polymorphism allows objects of different types to be handled using the same interface. It allows an operator or method to have different implementations depending on the type of object it is being applied to. Multiple inheritance allows a class to inherit characteristics from more than one parent class, but can lead to complexity and ambiguity, such as the "diamond problem" where a class inherits the same method through two parent classes. Selective inheritance allows a subtype to inherit only some functions of its supertype by using an EXCEPT clause to specify which functions are not inherited.
2. INTRODUCTION TO POLYMORPHISM
• Combination of two words: Poly and Morphism
• Ability of language to handle data of different types in the same
way.
• Way to change code behavior via input parameters without
direct modification.
• This concept allows the same operator name or symbol to be
bound to two or more different implementations of the
operator, depending on the type of objects to which the
operator is applied.
4. MULTIPLE INHERITANCE
• Feature in which an object or class can inherit characteristics
and features from more than one parent object or parent class.
• The multiple inheritance have complexity and ambiguity in
situations such as the "diamond problem“.
1. One solution is to have the system check for ambiguity when the subtype is
created, and to let the user explicitly choose which function is to be inherited
at this time.
2. Another is to disallow multiple inheritance altogether if name ambiguity
occurs, instead forcing the user to change the name of one of the functions in
one of the supertypes.
5. SELECTIVE INHERITANCE
• Selective inheritance occurs when a subtype inherits only some
of the functions of a supertype.
• EXCEPT clause may be used to list the functions in a supertype
that are not to be inherited by the subtype.
• Selective inheritance is not typically provided in OO database
systems.