83 lines
1.2 KiB
Plaintext
83 lines
1.2 KiB
Plaintext
bundle Default {
|
|
class Point {
|
|
@x : Int;
|
|
@y : Int;
|
|
|
|
New() {
|
|
@x := 0;
|
|
@y := 0;
|
|
}
|
|
|
|
New(x : Int, y : Int) {
|
|
@x := x;
|
|
@y := y;
|
|
}
|
|
|
|
New(p : Point) {
|
|
@x := p->GetX();
|
|
@y := p->GetY();
|
|
}
|
|
|
|
method : public : GetX() ~ Int {
|
|
return @x;
|
|
}
|
|
|
|
method : public : GetY() ~ Int {
|
|
return @y;
|
|
}
|
|
|
|
method : public : SetX(x : Int) ~ Nil {
|
|
@x := x;
|
|
}
|
|
|
|
method : public : SetY(y : Int) ~ Nil {
|
|
@y := y;
|
|
}
|
|
|
|
method : public : Print() ~ Nil {
|
|
"Point"->PrintLine();
|
|
}
|
|
}
|
|
|
|
|
|
class Circle from Point {
|
|
@r : Int;
|
|
|
|
New() {
|
|
Parent();
|
|
@r := 0;
|
|
}
|
|
|
|
New(p : Point) {
|
|
Parent(p);
|
|
@r := 0;
|
|
}
|
|
|
|
New(c : Circle) {
|
|
Parent(c->GetX(), c->GetY());
|
|
@r := c->GetR();
|
|
}
|
|
|
|
method : public : GetR() ~ Int {
|
|
return @r;
|
|
}
|
|
|
|
method : public : SetR(r : Int) ~ Nil {
|
|
@r := r;
|
|
}
|
|
|
|
method : public : Print() ~ Nil {
|
|
"Circle"->PrintLine();
|
|
}
|
|
}
|
|
|
|
class Poly {
|
|
function : Main(args : String[]) ~ Nil {
|
|
p := Point->New();
|
|
c := Circle->New();
|
|
p->Print();
|
|
c->Print();
|
|
}
|
|
}
|
|
}
|