Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted by kenny ( 15 years ago )
program Example;
uses
 Graph, FigObj;
type
 PBall=^Ball;
 Ball=Object(point)
           Radius,y,x: integer;
           constructor Init(initx,inity:integer);
           procedure Show; virtual;
           procedure Hide; Virtual;
           procedure Paint;
           procedure clear;
           procedure Move;
          end;
var
 DriverVar,ModeVar,MaxX,MaxY:Integer;

procedure CheckRez(var MaxX,MaxY:integer);
begin
 MaxX:=GetMaxX;
 MaxY:=GetMaxY;
end;

constructor Ball.Init;
Begin
 inherited init;
 X:=initx div 2;
 Y:=inity div 2;
end;

procedure Ball.Paint;
begin
 SetColor(2);
 Circle(X div 2,Y div 2,50);
 FillEllipse(x,y,50,50);
end;

begin
 DriverVar:=Detect;
 InitGraph(DriverVar,ModeVar,'..\BGI');
 if GraphResult <> GrOK then
 begin
  WriteLn(GraphErrorMsg(DriverVar));
  Halt(1);
 end
 else
 Begin
  CheckRez(MaXX,MaxY);
  new(PBall);
  ball.init(Maxx,Maxy);
  Ball.Paint(MaxX,MaxY);
 end;
 readkey;
end.

 

Revise this Paste

Children: 30766
Your Name: Code Language: