‎2007 Feb 13 6:47 AM
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
‎2007 Feb 13 7:12 AM
‎2007 Feb 13 7:17 AM
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
‎2007 Feb 13 7:23 AM
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.