geometry.ads

来自「Ada 2005 Training Notes.」· ADS 代码 · 共 77 行

ADS
77
字号
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 + =
减小字号Ctrl + -
显示快捷键?