Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
46
Task/Polymorphism/Elena/polymorphism.elena
Normal file
46
Task/Polymorphism/Elena/polymorphism.elena
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import extensions;
|
||||
|
||||
class Point
|
||||
{
|
||||
prop int X;
|
||||
prop int Y;
|
||||
|
||||
constructor new(int x, int y)
|
||||
{
|
||||
X := x;
|
||||
Y := y
|
||||
}
|
||||
|
||||
constructor new()
|
||||
<= new(0,0);
|
||||
|
||||
print() { console.printLine("Point") }
|
||||
}
|
||||
|
||||
class Circle : Point
|
||||
{
|
||||
prop int R;
|
||||
|
||||
constructor new()
|
||||
<= new(0);
|
||||
|
||||
constructor new(int r)
|
||||
<= new(0, 0, r);
|
||||
|
||||
constructor new(int x, int y, int r)
|
||||
<= new(x, y)
|
||||
{
|
||||
R := r
|
||||
}
|
||||
|
||||
print() { console.printLine("Circle") }
|
||||
}
|
||||
|
||||
public program()
|
||||
{
|
||||
Point p := Point.new();
|
||||
Point c := Circle.new();
|
||||
|
||||
p.print();
|
||||
c.print()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue