📄 geometry.ads
字号:
with Ada.Numerics.Elementary_Functions;with Ada.Numerics;use Ada.Numerics.Elementary_Functions;use Ada.Numerics;package Geometry is type Object is abstract tagged private; -- Client Visible Part function Distance (O: in Object) return Float; function Area(O: Object) return Float is abstract; -- -- All derived types must implement MI -- function MI(O: Object) return Float is abstract; -- -- -- function MO(OC: in Object'Class) return Float; type Circle is tagged private; function Area(C: in Circle) return Float; function MI(C: in Circle) return Float; type Point is tagged private; function Area(P: in Point) return Float; function MI(P: in Point) return Float; -- -- Moment of any Object -- function Moment(OC: Object'Class) return Float; type Pointer is access Object'Class; type Cell is record Next: access Cell; Element: Pointer; end record; -- -- Add any Object to the List -- procedure Add_To_List (List: access Cell; OP: Pointer); private -- Server Visible Part type Object is abstract tagged record Pos_X: Float; Pos_Y: Float; end record; type Circle is new Object with record Radius: Float; end record; type Point is new Object with null record; -- Parent type must not be a class-wide type error -- type WCObject is new Object'Class with null record; -- type of object cannot be abstract -- AbsObj : AbstractObject; --end Geometry;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -