13.07.2015 Views

Using Caché Studio - InterSystems Documentation

Using Caché Studio - InterSystems Documentation

Using Caché Studio - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Introduction to <strong>Caché</strong> <strong>Studio</strong>1.3.1 Class Definitions as TextThe following is an example of a class definition that defines a class containing one property and onemethod:/// Definition of a simple persistent Person classClass MyApp.Person Extends %Persistent [ClassType = persistent]{/// The name of the PersonProperty Name As %String;/// A simple Print methodMethod Print() As %Boolean{// Write out Person's NameWrite "Name is: ", ..NameQuit 1}}1.3.1.1 Class InformationA class definition starts with the declaration of the class name and any class-wide characteristics, suchas:Class MyApp.Student Extends Person{}This example defines a class called MyApp.Student (with no properties, methods, or other members)that extends (is derived from) the class MyApp.Person (since Student and Person are in the samepackage, we can omit MyApp from the Extends statement). The { } (braces) enclose the definition ofthe class members (of which there are none in this example).You can specify additional characteristics for this class by defining values for class keywords. This isdone by placing a list of keywords (possibly with values) in [ ] (brackets) immediately following theclass declaration (after the class name and superclass name (if any)).For example, you can specify that the class as Final and the name of its corresponding SQL table asStudentTable.Class MyApp.Student Extends Person [Final, SqlTableName=StudentTable]{}You can also provide a description for this class by placing a description comment (identified by ///,three slashes) immediately before the declaration of the class. This description is used when you viewthe class documentation via the <strong>Caché</strong> online class reference. It may contain HTML markup. Example:6 <strong>Using</strong> <strong>Caché</strong> <strong>Studio</strong>

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

Saved successfully!

Ooh no, something went wrong!