Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- * Paket
- * Specifikationsdel (.ads)
- * Implementationsdel (.adb)
- * Publikt/privat
- * (Deklarera) undantag
- ----------------------------------
- with Time_Handling; use Time_Handling;
- procedure Orientering is
- T1, T2 : Time_Type;
- begin
- Get(T1);
- Get(T2);
- Put(T1);
- end Orientering;
- -------------------------------------
- (Specifikationsdelen)
- allt som är över private --> Publik del
- allt som är under private --> Privat del
- specifikationsdelen innehåller bara information om vad som finns
- with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
- with Ada.Text_IO; use Ada.Text_IO;
- time_handling.ads
- package Time_Handling is
- type Time_Type is private -- berättar att datatypen finns, inte hur den fungerar
- procedure Get(Item : out Time_Type);
- procedure Put(Item : in Time_Type);
- function "<"(Left, Right: in Time_Type) return Boolean;
- private
- type Time_Type is
- record
- H, M, S : Integer;
- end record;
- end Time_Handling;
- --------------------------------------
- (Implementationsdel)
- time_handling.adb
- package body Time_Handling is
- procedure Get(Item : out Time_Type) is
- C: Character;
- begin
- Get(Item.H);
- Get(C)
- Get(Item.M);
- Get(C);
- Get (Item.S);
- end Get;
- procedure Put(Item : in Time_Type) is
- begin
- end Put;
- function "<"(Left, Right : in Time_Type) return Boolean is
- begin
- end "<";
- end Time_Handling;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement