Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
36
Task/Polymorphism/PascalABC.NET/polymorphism.pas
Normal file
36
Task/Polymorphism/PascalABC.NET/polymorphism.pas
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
type
|
||||
Point = class
|
||||
public
|
||||
auto property x: real;
|
||||
auto property y: real;
|
||||
constructor (x,y: real);
|
||||
begin
|
||||
Self.x := x; Self.y := y;
|
||||
end;
|
||||
procedure Print; virtual;
|
||||
begin
|
||||
PABCSystem.Print(x,y);
|
||||
end;
|
||||
end;
|
||||
Circle = class(Point)
|
||||
public
|
||||
auto property r: real;
|
||||
constructor (x,y,r: real);
|
||||
begin
|
||||
inherited Create(x,y);
|
||||
Self.r := r;
|
||||
end;
|
||||
procedure Print; override;
|
||||
begin
|
||||
inherited Print;
|
||||
PABCSystem.Print(r);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
var p: Point := new Point(3,5);
|
||||
var c: Circle := new Circle(10,8,4);
|
||||
p.Print;
|
||||
Println;
|
||||
c.Print;
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue