Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

bracket doubt

Former Member
0 Likes
356

hi,

i got the helpful reply below but would like to clarify.

(If var is an attribute, then you can say)

val = vessel1->var

if var is a method with a returning addition,

val = vessel->var( ).

1) why the bracket is empty also can assignment value to val?

vessel_id = vessel2->get_id( )

2) if i leave the bracket empty for call method vessel1->drive( ), i will have compile error. so at least i must put 0 in bracket.

call method vessel1->drive exporting speed_up = 50

call method vessel1->drive( 50 )

3) why point 1 can leave empty in ( ) whereas point 2 must have at least 0? get_id and drive both are method and not attribute.

4) if var is a method with a RETURNING addition then only can have this kind of assignment?

val = vessel->var( ).

which means other addition cannot have such assignment rite?

thanks

3 REPLIES 3
Read only

Former Member
0 Likes
334

hi all,

any help pls.

thanks

Read only

Former Member
0 Likes
334

1) why the bracket is empty also can assignment value to val?

vessel_id = vessel2->get_id( )

There may not be any IMPORTING parameters for that method , thats why the bracket is empty

2) if i leave the bracket empty for call method vessel1->drive( ), i will have compile error. so at least i must put 0 in bracket.

call method vessel1->drive exporting speed_up = 50

call method vessel1->drive( 50 )

For the method drive(50) , there should be an importing parameter , thats why it will accept the value of 50 and do the further processing of that method

Read only

Former Member
0 Likes
334

1.vessel_id = vessel2->get_id( )

vessel_id -


This is avariable which can hold the value of ID of same type

vessel2 -


Instance of the class

--> This is the symble to cal the method by instace.

get_id( )-----Is the method

Empty bracket shows the empty parameters of the method.Just like our subroutine.

vessel_id = vessel2->get_id( ).

Answer for above syntax is when you call the method get_id by instance it will return the "ID value" which will assign to field "vessel_id ".

2.For that method "get_id " atribute might set as this paramter is compusory.

3.For point 1 that attribute is not compulsory.

4. Yes.

Pls. reward points if useful.