Skip to Content
Oct 24, 2007 at 04:21 AM

doubt in casting


hi sdns,

i am new to OOABAP.I am being trained on this concepts.I am facing a lot of difficulty in understanding Narrowing Cast & Widening Cast.I have some doubts in that.

i have a doubt in widening cast.I Know that we are increasing the scope with the same object in widening cast.

if we have two classes airplane,cargo_airplane

DATA: airplane TYPE REF TO lcl_airplane,

cargo_airplane TYPE REF TO lcl_cargo_airplane,

cargo_airplane2 TYPE REF TO lcl_cargo_airplane.

CREATE OBJECT cargo_airplane.

airplane = cargo_airplane.

cargo_airplane2 ?= airplane.

if we have a method in airplane.we have a redefined it in cargo_airplane.

After this widening cast.

if we acccess this method from cargo_airplane2.

which method will it access redefined method or the method in super class.

please do explain me this example clearly.

with regards,