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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Experimenting with the OOP features in Ada Date: Mon, 2 Jan 2017 14:11:40 -0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <29380aa7-0c3b-4908-94c6-aa91f3996b42@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Mon, 2 Jan 2017 14:11:40 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="6c1c38fcc435c066e6d8e3c9711220ef"; logging-data="24166"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+BXpWvA69kxDGznQxqV05dGX3E5ATddZE=" User-Agent: Pan/0.140 (Chocolate Salty Balls; GIT b8fc14e git.gnome.org/git/pan2) Cancel-Lock: sha1:7Ey8FVhYS5gm+arVjs3y0GX7dsw= Xref: news.eternal-september.org comp.lang.ada:32995 Date: 2017-01-02T14:11:40+00:00 List-Id: On Mon, 02 Jan 2017 05:21:49 -0800, Laurent wrote: > Hi > > Happy new year! > > Trying some OOP features in Ada. So not sure if everything is actually > correct. > Comments are welcome. > > So I have done a little test. Link at the end. > I get the following error: > > raised CONSTRAINT_ERROR : my_strings-handle.adb:14 access check failed > > Which I don't understand. Sounds like the object no longer exists? Test_Antibiotic := Base_Types.Antibiotics.Create_Name (Name => "Test Antibiotic 3"); Test_Antibiotic := Base_Types.Antibiotics.Create_Code_SIL (Code_SIL => "gen"); Test_Antibiotic := Base_Types.Antibiotics.Create_CMI (CMI => "8"); Test_Antibiotic := Base_Types.Antibiotics.Create_SIR (SIR => "I"); Looks like you're creating 4 new Base_Types.Antibiotics.Objects here and discarding the first three. The fourth has whatever the default is for its Name, instead of "Test Antibiotic 3", whose owner got discarded. I suspect you intended something more like Test_Antibiotic := Base_Types.Antibiotics.Create_Name (Name => "Test Antibiotic 3"); Test_Antibiotic.Set_Code_SIL (Code_SIL => "gen"); Test_Antibiotic.Set_CMI (CMI => "8"); Test_Antibiotic.Set_SIR (SIR => "I"); or even another call to the all-in-one Create you used initially. -- Brian