From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FILL_THIS_FORM,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ab973a0f1581087e,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-07 14:00:12 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!isdnet!grolier!btnet-peer0!btnet!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail From: "chris.danx" Newsgroups: comp.lang.ada Subject: Information hiding and Stream IO X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: Date: Sat, 7 Apr 2001 21:52:55 +0100 NNTP-Posting-Host: 213.104.128.81 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 986676754 213.104.128.81 (Sat, 07 Apr 2001 21:52:34 BST) NNTP-Posting-Date: Sat, 07 Apr 2001 21:52:34 BST Organization: ntlworld News Service Xref: supernews.google.com comp.lang.ada:6621 Date: 2001-04-07T21:52:55+01:00 List-Id: Hi again folks, The question follows this introduction ------------------------ beginning of introduction I devised the following example: At a kenel, the records of owners and their dogs are stored in a file. Unfortuanately the guy who programmed the computer system didn't do a very good job. He decided to store the information on the owner and their dog in a file one after the other like this Owner, Dog, Owner, Dog, ... He wanted each owner to be followed by the dog he/she owned, but he's been careless; the records have become jumbled. It still follows the owner, dog, owner pattern but the information on each dog doesn't follow on from the information on that dog's owner. You're task is to write a program that reads the records of 10 owners and 10 dogs from the file and create a new file and write the records to it so that the record of the each dog follow their owners record. The record on the owner looks like this type owner_type is record name : name_type; -- the name; name_len : natural; -- the names length; age : natural; -- age of person; sex : sex_type; -- sex of person; end record; and that of the dog looks like type dog_type is record name : dog_name_type; -- name of dog; name_len : natural; -- dog name length; age : natural; -- age of dog; sex : sex_type; -- sex of dog; owner : owner_name_type; -- owners name; owner_len : natural; -- owner name length; end record; where owners have names of max 30 characters and dogs 10. and sex_type is type sex_type is (female, male); ------------------ end of introduction I've got a package Owners, which contains a type Owner_Type and some operations like My_Name, My_Age, My_Sex. I've also got another package Doggies containing the type Dog_Type and similar operations with the inclusion of My_Owner. The example is meant to use streams for files. Now i've got a tricky problem, which relates to this example. I'd like to put the IO routines in a child package of Owners, and Doggies. I don't know if i can do this however as Owner_Type and Dog_Type are both private types. I should have two routines for each one, Owner_Type'read and Owner_Type'write Which ideally i'd like to put in child package but i don't know if this will work since i've got to access each field in the record separately. There is the possibility to use the standard ones provided for each type, but that'd not make a good example. What should i do? I'm just about to start coding the first program which creates the file with 10 owners and 10 dogs all jumbled. Cheers, Chris Campbell