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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Mart van de Wege Newsgroups: comp.lang.ada Subject: Re: Confused about class-wide types Date: Sun, 20 Mar 2016 15:01:57 +0100 Message-ID: <868u1d6yei.fsf@gaheris.avalon.lan> References: <86oaa97635.fsf@gaheris.avalon.lan> Mime-Version: 1.0 Content-Type: text/plain X-Trace: individual.net tpCRKE+FWigenGpqqW4TJgWb319qQ6jXKVYnr48e0sRvqoX955 X-Orig-Path: gaheris.avalon.lan!not-for-mail Cancel-Lock: sha1:wwh8YBqR2EWlX2YJysoSD93+5sE= sha1:PJ4UeFV26nbdIyqo+voVL+aZVgo= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Xref: news.eternal-september.org comp.lang.ada:29833 Date: 2016-03-20T15:01:57+01:00 List-Id: Simon Wright 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.