NARROW CASTING:
Assigning the instance of subclass to a reference variable of superclass is known as Narrow Cast.
SUPER ([Link]) = SUB (INSTANCE)
Narrow Casting allows us to access the inherited components in subclass from the reference variable of
superclass.
Narrow Cast can also be applied at the time of object creation:
CREATE <obj> SUPER ([Link]) TYPE <sub_class>
WIDENING CASTING
Assigning instance of superclass to a reference variable of subclass is known as Widening Cast.
SUB ([Link])? = SUPER (INSTANCE)
After widening cast we can access back all the components of sub class.
USE:
Narrow casting is used in Dynamic method call.
Allow us to extend the functionality of a class without changing the method signature.
No need to create instances with CREATE OBJECT statement.