comp.lang.ada
 help / color / mirror / Atom feed
From: Mart van de Wege <mvdwege@gmail.com>
Subject: Re: Confused about class-wide types
Date: Sun, 20 Mar 2016 15:01:57 +0100
Date: 2016-03-20T15:01:57+01:00	[thread overview]
Message-ID: <868u1d6yei.fsf@gaheris.avalon.lan> (raw)
In-Reply-To: ly4mc1xqp9.fsf@pushface.org

Simon Wright <simon@pushface.org> writes:

> I think this is difficult because you've introduced operations for the
> child (Message_Event) of which the parent (Event) has no analogue at
> all. What is the common operation that all Events must support?
> Maybe something like
>
>    procedure Handle (E : Event) is abstract;
>
> Your procedure Message is a factory, I think; it might be better as
>
>    function Message (Mess : in String) return Message_Event;
>

I was over-designing a bit. At current I only need two classes: an event
with a unstructured String as a Message, and a child event with a bit
more metadata in the record, so I thought I'd start out with an abstract
Event class in my Vector definition, and build the generic operations
first.

Shark8 pointed out the right solution: use an Indefinite_Vector, but
your and Dimitri's posts help a lot with understanding where I went
wrong, thanks.

Mart

-- 
"We will need a longer wall when the revolution comes."
    --- AJS, quoting an uncertain source.

  reply	other threads:[~2016-03-20 14:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-20 11:15 Confused about class-wide types Mart van de Wege
2016-03-20 12:29 ` Dmitry A. Kazakov
2016-03-20 13:58   ` Mart van de Wege
2016-03-20 14:26     ` Dmitry A. Kazakov
2016-03-20 12:46 ` Simon Wright
2016-03-20 14:01   ` Mart van de Wege [this message]
2016-03-20 13:18 ` Shark8
2016-03-20 13:56   ` Mart van de Wege
2016-03-21 21:54   ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox