Skip to Content
0
Former Member
Jun 11, 2011 at 09:35 AM

Widening casting-code

117 Views

class parent definition.

public section.

data pub_parent type i.

endclass.

class child definition inheriting from parent.

public section.

data pc type i.

endclass.

data parent type ref to parent.

data child type ref to child.

data child1 type ref to child.

create object child.

create object parent.

try.

parent ?= child.

catch cx_sy_move_cast_error.

write 'error'.

endtry.

-


Hi all

code snippet above doesnt gives me any error..I am doing narrow casting here with a widening cast operator ?=.does that mean ,when it comes to narrow casting u can use either = or ?=.it doesnt make any difference?