next up previous contents
Next: Procedure Calls Up: Statements Previous: Loops and the Break

Method Calls

 
  method_call ::=  designator [`!'] [ '(' arguments ')' ] .
  arguments ::= argument ( ',' argument )\stern .
  argument ::=  general_expression  |  '\&' designator |  '\&\&' designator .

Example: max(a,b); i1.divmod(i2,& div, & mod); obj.attr.elts!; o.f(,,); tex2html_wrap_inline1707

Direct stream calls and calls of a stream are distinguished by the symbol ! after its identifier.

Methods whose bodies are external belong to an external class. The body can indicate what name the compiler is to use to refer to the appropriate extternal procedure. If the name is not explicitly given (by a string constant), the name of the procedure will be used cf. 9.1.2.

Method calls can be object calls a.m or class calls C::m. If the type of a is a polymorphic type $C (polymorphic method call) then the declaration of m in class tex2html_wrap_inline2445 is used for checking the validity of the call and for inferring the type of arguments and the result.

A method call carries as its 0-th argument the reference to its object. In the method body this argument has the name self of type C. When the method is called by tex2html_wrap_inline2449 without reference to an object then the value of self is void. self is a constant local entity of the method.

A method call is valid only





Martin Trapp
Mon Feb 17 16:49:16 MET 1997