From: Shark8 <onewingedshark@gmail.com>
Subject: Re: OOP in Ada: Alternatives for "protected" scope
Date: Fri, 4 May 2012 21:33:59 -0700 (PDT)
Date: 2012-05-04T21:33:59-07:00 [thread overview]
Message-ID: <8966703.3.1336192439923.JavaMail.geo-discussion-forums@ynee1> (raw)
In-Reply-To: <jo18al$f4m$1@online.de>
On Friday, May 4, 2012 1:48:53 PM UTC-5, Felix Krause wrote:
>Compared to my version (with redispatching issues fixed), this
alternative enforces a weaker contract. It does not enforce the child
classes to call Do_Prologue and Do_Epilogue when implementing
Do_Something. While this fixes the problem that I cannot have an
abstract method in the private part, I think the mix-in solution you
suggested in your second post is a better way to handle this.
Couldn't you fix this by something like the following:
Type Base is tagged null record;
Procedure Do_Prolog( Object : in out Base'Class );
Procedure Do_Epilog( Object : in out Base'Class );
-- Both called defined in the body
Procedure Work( Object : in out Base ) is abstract;
Procedure Do_Work( Object : in out Base'Class );
with a body of:
Procedure Do_Work( Object : in out Base'Class ) is
begin
Object.Do_Prolog;
Object.Work;
Object.Do_Epilog;
end Do_Work;
Or am I misunderstanding your intent?
next prev parent reply other threads:[~2012-05-05 4:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-03 21:27 OOP in Ada: Alternatives for "protected" scope Felix Krause
2012-05-03 21:56 ` Dmitry A. Kazakov
2012-05-04 18:48 ` Felix Krause
2012-05-04 22:00 ` Dmitry A. Kazakov
2012-05-05 8:28 ` Felix Krause
2012-05-05 11:53 ` Dmitry A. Kazakov
2012-05-05 4:33 ` Shark8 [this message]
2012-05-03 23:34 ` Randy Brukardt
2012-05-04 1:41 ` BrianG
2012-05-04 10:37 ` Georg Bauhaus
2012-05-04 10:43 ` Georg Bauhaus
2012-05-04 12:10 ` 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