The format of the fitter definition is:
Access-control fitter Class-name(Argument)
It is a definition that starts with access control, followed by the keyword fitter, and ends with the keyword endfitter.
The name of the fitter must be the same as the class name.
You can define fitters that combinations of arguments are different and place anywhere in the class definition.
The fitter definition will generate a scope.
It specifies the access level of the fitter using the keywords open or closed.
If you specify open, the fitter can be called from outside of the class definition.
If you specify closed, the fitter can only be used inside of the class definition.
It is a keyword that indicates that it is a fitter definition. It must be specified next to access control.
It specifies the class name after the keyword fitter.
Fitter arguments are specified next to the Class-name, it must be enclosed by parentheses.
An argument is a pair of class name and argument name.
If there are two or more arguments, separate them with commas. No comma is required when one argument. If no argument, the parentheses are empty.
Since the fitters are distinguished by the order of the argument classes, you can define fitters as many as you like if they have different argument order.
It is a keyword that indicates the end of the fitter definition.
You can use the abbreviation "ef" instead of "endfitter". Note that "ef" is also a keyword.
A fitter with no arguments is called a default fitter. If there is a user-defined default fitter, it will be called.
If there is no user-defined default fitter, a default fitter is automatically generated and called.
The instance returned by the automatically generated default fitter is the same as if a variable of that class was declared.
Let's define fitters in the example class.
open fitter example() // Default fitter.
x = 0;
y = 0;
open fitter example(int xx, int yy) // Fitter with two arguments.
x = xx;
y = yy;
ef // Abbreviation.
The fitter is called with a new expression.
example ex = new example(10, 10);