25.01.2015 Views

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Methods<br />

Write dog.Speak()<br />

Which could result in the following code being generated:<br />

Write "Woof, Woof"<br />

It is a good idea to give all formal variables of an expression method default values. This<br />

prevents potential inline substitution problems caused by missing actual variables at runtime.<br />

Note:<br />

<strong>Caché</strong> does not allow macros or call-by-reference arguments within expression<br />

methods.<br />

6.7.3 Call Methods<br />

A call method is a special mechanism to create method wrappers around existing <strong>Caché</strong><br />

routines. This is typically useful when migrating legacy code to object-based applications.<br />

Defining a method as a call method indicates that a specified routine is called whenever the<br />

method is invoked. The syntax for a call method is:<br />

Method Call() [ CodeMode = call ]<br />

{<br />

Tag^Routine<br />

}<br />

where “Tag^Routine” specifies a tag name within a routine.<br />

6.7.4 Method Generators<br />

A method generator is actually a small program that is invoked by the Class Compiler during<br />

class compilation. Its output is the actual runtime implementation of the method. Method<br />

generators provide a means of inheriting methods that can produce high performance, specialized<br />

code that is customized to the needs of the inheriting class or property. Within the <strong>Caché</strong><br />

library method generators are used extensively by the data type and storage classes.<br />

For details refer to the Method Generators chapter.<br />

44 <strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!