📚 The CoCalc Library - books, templates and other resources
cocalc-examples / martinthoma-latex-examples / documents / Programmierparadigmen / scripts / x10 / x10-struct-example.x10
201861 viewsLicense: OTHER
struct Complex {
val real:Double;
val img :Double;
def this(r:Double, i:Double) {
real = r; img = i;
}
def operator + (that:Complex) {
return
Complex(real + that.real,
img + that.img);
}
}
val x = new Array[Complex](1..10);