From: Brian Drummond <brian@shapes.demon.co.uk>
Subject: Re: Experimenting with the OOP features in Ada
Date: Tue, 3 Jan 2017 13:01:23 -0000 (UTC)
Date: 2017-01-03T13:01:23+00:00 [thread overview]
Message-ID: <o4g7b3$ba6$2@dont-email.me> (raw)
In-Reply-To: bb087830-32e3-4d06-a102-979e9a1e6d68@googlegroups.com
On Mon, 02 Jan 2017 08:27:44 -0800, Laurent wrote:
> On Monday, 2 January 2017 15:44:57 UTC+1, Brian Drummond wrote:
>> So the
>> following are equivalent:
>>
>> Test_Antibiotic := Base_Types.Antibiotics.Create_Code_SIL (
>> This => Test_Antibiotic, Code_SIL => "Test
>> Antibiotic 3")
>>
>> Test_Antibiotic := Test_Antibiotic.Create_Code_SIL
>> (Code_SIL => "Test Antibiotic 3");
>>
>> but the preferred form would be
>>
>> Test_Antibiotic.Set_Code_SIL (Code_SIL => "gen");
>>
>> -- Brian
>
> Yes last one looks nice but doesn't work. No selector... Object is
> private.
> So 2nd one.
> Now I won't compile because Base_Types.Object is abstract. So I have to
> figure out how/where to put the overriding works. In John Barnes Book it
> looks so easy and light. Doing it myself feels clumsy
I recommend learning how to make the nicest looking one work; my
procedure was a first pass at guidance, not a complete solution.
Procedure Set_Code_SIL (This : in out Base_Types.Antibiotics.Objects;
Code_SIL => "gen");
Where did you put this procedure?
As Dmitry says, you need to provide setters if you're manipulating parts
of an object, so this procedure, a setter, should be part of the
Base_Types.Antibiotics package (with implementation in its body) so that
it has access to the private part, where the components are declared.
The error message fragment (without file:location) you report suggests it
was probably somewhere else.
-- Brian
next prev parent reply other threads:[~2017-01-03 13:01 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-02 13:21 Experimenting with the OOP features in Ada Laurent
2017-01-02 14:11 ` Brian Drummond
2017-01-02 14:43 ` Brian Drummond
2017-01-02 16:27 ` Laurent
2017-01-03 13:01 ` Brian Drummond [this message]
2017-01-03 13:57 ` Laurent
2017-01-03 14:31 ` Dmitry A. Kazakov
2017-01-03 17:07 ` G.B.
2017-01-03 20:42 ` Dmitry A. Kazakov
2017-01-04 12:18 ` Laurent
2017-01-04 12:44 ` Dmitry A. Kazakov
2017-01-05 11:41 ` Laurent
2017-01-05 13:02 ` Dmitry A. Kazakov
2017-01-05 13:11 ` AdaMagica
2017-01-04 15:09 ` Shark8
2017-01-05 11:54 ` Laurent
[not found] ` <85ef59f3-bcbe-4630-9b4d-8285623ab456@googlegroups.com>
2017-01-03 12:48 ` Brian Drummond
2017-01-03 13:43 ` Laurent
2017-01-02 15:54 ` Laurent
2017-01-02 16:41 ` Dmitry A. Kazakov
2017-01-02 18:50 ` Laurent
2017-01-02 20:55 ` Dmitry A. Kazakov
2017-01-03 13:39 ` Laurent
2017-01-03 14:40 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox