pascalabcnet/TestSuite/CompilationSamples/Stamp1.pas

29 lines
698 B
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Штампы - это классы графических фигур, хранящие их параметры
// В любой момент можно нарисовать графическую фигуру, вызвав метод Stamp.
// Класс штампа прямоугольника
uses GraphABC;
type
RectangleStamp = class
x,y,w,h: integer;
constructor (xx,yy,ww,hh: integer);
begin
x := xx; y := yy;
w := ww; h := hh;
end;
procedure Stamp;
begin
Rectangle(x,y,x+w,y+h);
end;
end;
begin
var r := new RectangleStamp(30,30,50,50);
r.Stamp;
for var i:=1 to 10 do
begin
r.x := r.x + r.w +5;
r.Stamp;
end;
end.