Home About Rice Downloads Documents Others Cooker CookerGX
Documents  >  Tutorial  >  fitters

Purpose of this chapter.

We will learn about the fitter which is the basic elements that make up the class definition.


The Fitter specifies how to initialize when an instance of the class is created.

First, let us look at the fitter definition part of Circle.88.


// -----------------------------------------------fitters.


open fitter Circle(int radius)


_radius.Value = radius; // Encapsulation.


_box = _doc.GetElementById("box");


_hor = 1;


_ver = -1;


_tt = new timer(this, "timerHandler(timer)", 10);


_fitted = true;



A definition of the fitter is the following format.

access-control(open or closed) fitter fitter-name ( arguments... )

Statements of the fitter definition...


The fitter definition is the definition that starts with access control and the 'fitter' keyword. And, it ends with 'endfitter' keyword.

The name of the fitter must be the same as the class name.

The fitter will be distinguished by differences of the arguments. If all fitters are different, it can be declared any number at any place outside of the other members definition.

Access control

The access level of the fitter will be specified using the 'open' or 'closed' keyword.

If the 'open' keyword is specified, the fitter can be used anywhere in the program.

If the 'closed' keyword is specified, the fitter is available only the inside of the class definition.

The 'closed' members of all instances of the same class can be accessed at the inside the class definition.

fitter keyword

The 'fitter' keyword indicates that this definition is a fitter definition. It must be specified at the next of the access-control.

Fitter name

The fitter-name must specify at the next of the 'fitter' keyword. It must be the same as the name of the class which this fitter belongs.


The arguments of the fitter must be specified at the next of the fitter-name, it must be enclosed by parentheses.

The arguments are specified by the set of class-name (type of the argument) and argument-name.

If there are two or more arguments, it are separated by a comma. If number of the argument is one, comma is not required. If there is no argument, inside of the parentheses is empty.

Rice will distinguish the fitter by the order of the type of argument. The fitter that has the different arguments can be defined any number.

The Rice creates a name for calling a fitter from fitter-name and arguments.


open fitter A() -> "A()"

open fitter A(int val) -> "A(int)"

closed fitter A(int iVal, string sVal) -> "A(int,string)"

Please note that the access control does not related to the generation of the name.

endfitter keyword

The 'endfitter' keyword indicates the end of the fitter definition.

Default fitter

A fitter with no argument is called as the default-fitter. If there is a default-fitter that is defined by user, the calling of the default-fitter will call its default-fitter.

If the default-fitter is not exist, A default-fitter will generate automatically, and the calling of the default-fitter will call its default-fitter.

An instance that is returned by automatically defined default-fitter is the same as an instance that is returned if the variable of that class was declared. In other words, there is a possibility that is not properly initialized.

Copyright © Rice All rights reserved.