Код:
Uses CRT, Graph;
Type TFigure=Object
x,y:Integer;
color:Word;
Constructor Init (ax,ay:Integer; col:Word);
Procedure Draw (col:Word); Virtual;
Procedure Show;
Procedure Hide;
Procedure MoveTo (dx, dy:Integer);
End;
TPoint=Object(Tfigure)
Procedure Draw (col:Word); Virtual;
End;
TEllipse=Object(TPoint)
U1,U2,xr,yr:Integer;
Constructor Init(ax,ay,axr,ayr,aU1,aU2:Integer; col:Word);
Procedure Draw (col:Word); Virtual;
End;
Constructor TFigure.Init (ax, ay:Integer; col:Word);
Begin x:=ax; y:=ay; color:=col; End;
Procedure TFigure.Draw(col:Word);
Begin End;
Procedure TFigure.Show;
Begin Draw (Color); End;
Procedure TFigure.Hide;
Begin Draw (GetBkColor); End;
Procedure TFigure.MoveTo (dx, dy:Integer);
Begin Hide; x:=x+dx; y:=y+dy; Show; End;
Procedure TPoint.Draw (col:Word);
Begin PutPixel (x, y, col); End;
Constructor TEllipse.Init;
Begin Inherited Init (ax, ay, col); xr:=axr; yr:=ayr; U1:=aU1; U2:=aU2; End;
Procedure TEllipse.Draw(col:Word);
Begin SetColor (col); Ellipse (x,y,U1,U2,xr,yr); End;
{Pryamougolnik}
Type TBar=object
a,b,c,d:integer;
color:word;
Constructor initt(ea,eb,ec,ed:integer; coll:word);
Procedure Draww (coll:word); virtual;
Procedure Showw;
Procedure Hidee;
Procedure MoveToo(wa,wb,wc,wd:integer; coll:word);
End;
Constructor TBar.Initt(ea,eb,ec,ed:integer; coll:word);
Begin a:=ea; b:=eb; c:=ec; d:=ed; color:=coll end;
Procedure Tbar.Draww(coll:word);
Begin end;
Procedure Tbar.Showw;
Begin Draww(color); end;
Procedure Tbar.Hidee;
Begin Hidee; Draww(GetBkColor); end;
Procedure TBar.MoveToo(wa,wb,wc,wd:integer; coll:word);
Begin Setcolor(coll); a:=a+wa; b:=b+wb; c:=c+wc; d:=d+wd; showw; end;
Var driver,mode:integer;
VEllipse:TEllipse;
VBar:TBar;
Begin
Driver:=detect;
initGraph(Driver,Mode,'C\:Pascal');
VEllipse.Init (100,300,50,80,11,10,17);
VEllipse.Show;
Vbar.initt(100,200,60,33,4);
Vbar.showw;
ReadKey;
CloseGraph;
End.
Здравствуйте.
Не показывает прямоугольник, а только эллипс