class Test {
// Class properties initialization
// This code is executed BEFORE the constructor
→000001double X →000030= 5;
→000002double Y →000031= 5*X; // 'X' is local variable - property of 'Test' class
// User defined constructors
// Constructor's code is executed, when you are creating a new instance of the class with keyword "new"
void Test(double _X, double _Y) {
X →000032= _X;
Y →000033= _Y;
}
void Test(double A, double B, double C, double D) {
// value of 'X' is initialised (line 4) before the constructor is called.
Y →000037= X↑2←+A*B+C*D; // you can use 'X' without any limitation
}
// standard class function
void Print() {
→000003TEXT("X = " & X);
→000004TEXT("Y = " & Y);
}
}
// default constructor with no parameters is generated automatically
// you don't have to define it manually
object O1 →000011= new Test();
→000034O1.Print();
// user-defined constructor with 2 parameters
object O2 →000018= new Test(3, 4);
→000035O2.Print();
// user-defined constructor with 4 parameters
object O3 →000038= new Test(1, 2, 3, 4);
→000039O3.Print();
http://sciadesignforms.com/
Calculation
Layout 0
Layout 1
Layout 2
Layout 3
Layout 4
Layout 5
-
"X = " & X
-
"Y = " & Y