Fitter definition
Fitter definition
Fitter is a subroutine for initializing an instance. It is used with the new operator and returns an initialized copy of the prototype of the class.
Format is:
access-control fitter fitter-name(arguments)
statements
endfitter
It can use the abbreviation ef instead of endfitter.
In the class definition, it is possible to define fitters of any number at any place outside the other member definitions.
access control
Access-control determines the access level of the fitter by specifying a keyword either open or closed.
If it is open, you can invoke the fitter from outside the class definition. If it is closed, you can invoke the fitter only inside the class definition.
fitter
The fitter is a keyword which indicates this is a fitter. It must be present between the access-control and fitter-name.
fitter name
The fitter-name has to be the same as a class name that has the fitter as a member.
arguments
The argument is a pair of class name and identifier in parentheses. You can specify any number of such pairs. If there are two or more pairs, they must be separated by commas.
open fitter sampleClass()
open fitter sampleClass(int index)
open fitter sampleClass(int index, string message)
There are no special keywords to indicate that there are no arguments. If there are no arguments, you do not need to specify anything in parentheses.
statemants
Statements are optional. Namely, a fitter without statements is permitted. In that case, a simple copy of the prototype is returned.
endfitter
The endfitter is a keyword which indicates end of definition. you can use the abbreviation ef instead of endfitter.
overload
The fitter name has to be the same as a class name; you can define fitters of any number if number and class of arguments are different.
scope
A fitter generates a scope.
return
A fitter can return to invoker from anywhere by return statement. The return statement of the fitter should not return an instance. If the control has reached the endfitter without encountering a return statement, the control returns to invoker.