Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit KrugU;
- interface
- Uses PointU , SysUtils;
- Type Krug = class (Point)
- Protected
- Rad : real;
- public
- Constructor Create ( x ,y ,z , r : real) ;
- Procedure KoordFigur ( x , y , z , r : real);
- Procedure KoordRad ( r: real ) ;
- Function Print : string ; override ;
- function GetRad : real;
- end;
- implementation
- procedure Krug.KoordRad;
- begin
- if r>=0 then rad:= r else rad := 0 ;
- end;
- Constructor Krug.Create(x: Real; y: Real; z: Real; r: Real);
- begin
- inherited Create(x,y,z);
- KoordRad(r);
- end;
- procedure Krug.KoordFigur(x: Real; y: Real; z: Real; r: Real);
- begin
- KoordPoint(x,y,z);
- KoordRad(R);
- end;
- function Krug.print;
- begin
- result := (inherited Print) + ' , Rad = ' + FloatToStr ( Rad) ;
- end;
- Function Krug.GetRad;
- begin
- result := Rad;
- end;
- end.
- unit PointU;
- interface
- Uses SysUtils;
- Type Point = class
- private
- x , y , z : real;
- public
- Constructor Create (x1 , y1 , z1 : real ) ;
- procedure KoordPoint ( x1 , y1 , z1 : real ) ;
- function print : string ; virtual;
- end;
- implementation
- Constructor Point.Create(x1: Real; y1: Real; z1: Real);
- begin
- KoordPoint(x1 , y1, z1);
- end;
- procedure Point.KoordPoint(x1: Real; y1: Real; z1: Real);
- begin
- x := x1;
- y := y1;
- z := z1;
- end;
- function Point.print;
- begin
- print:= 'koordinats : ( ' + FloatToStr(x) + ' ; ' + FloatToStr(y) + ' ; ' + FloatToStr(z) + ' ) ';
- end;
- end.
- unit SphereU;
- interface
- Uses KrugU;
- Type Sphere = Class ( Krug)
- public
- Constructor Create ( x , y , z , r : real) ;
- Function Volume : real ;
- End;
- implementation
- Constructor Sphere.Create(x: Real; y: Real; z: Real; r: Real);
- begin
- Inherited Create ( x , y, z ,r ) ;
- end;
- Function Sphere.Volume;
- begin
- Result := 1.3333 * 3.1415 * rad * rad * rad;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement