cancel
Showing results for 
Search instead for 
Did you mean: 

object oriented concept

Former Member
0 Kudos

hi,

DATA: lr_table_settings type ref to cl_salv_wd_table_settings,

lr_column_settings type ref to If_salv_wd_column_settings.

lr_column_settings ?= l_value.

in the third step why we are using "?=" to assign with l_value.

why we are using only where we use the interface..

give some explanations pls....

thanks in advance...

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

lr_column_settings is a reference of object If_salv_wd_column_settings, l_value may reference to some other type or dynamic object reference but the programmer is sure that the value of l_value is the correct reference object for lr_column_settings. so to populate the object reference for lr_column_setting with l_value '?=' symbol is used as casting operator.

Hope this explains it

Regards,

Kinshuk

Former Member
0 Kudos

and could you pls explain me the difference b/w " -> " and " => " operator and significance

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

-> is an instance reference and => is a static reference

former_member189058
Active Contributor
0 Kudos

?= is the CASTING OPERATOR

When you use ?=, there is no static type check at design time to check the compatability of the two variables.

The system checks at runtime whether the object reference in the source variable points to an object to which the object reference in the target variable can also point. If the assignment is possible, the system makes it, otherwise, the catchable runtime error MOVE_CAST_ERROR occurs.

Reference: [Object Oriented Concept|http://help.sap.com/saphelp_nw70/helpdata/en/c3/225b5654f411d194a60000e8353423/frameset.htm]

Regards,

Reema

Former Member
0 Kudos

and could you pls explain me the difference b/w " -> " and " => " operator and significance

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>When you use ?=, there is no static type check at design time to check the compatability of the two variables.

That is not actually correct. There is a static check at design time to make sure that the two objects are at least compatible. If the objects don't share any interitance hierarchy or interface you will get a compile time syntax error. The only way that you get no static type check is if you are casting with objects that are generically typed (TYPE REF TO OBJECT). Then the interface check can't be performed until runtime.