mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
16 lines
298 B
Text
16 lines
298 B
Text
|
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);
|