comp.lang.ada
 help / color / mirror / Atom feed
From: Eryndlia Mavourneen <eryndlia@gmail.com>
Subject: Re: How can I declare a collection of an interface?
Date: Fri, 2 Aug 2013 09:53:05 -0700 (PDT)
Date: 2013-08-02T09:53:05-07:00	[thread overview]
Message-ID: <8a90e70f-8488-45da-81be-58da3e9ea381@googlegroups.com> (raw)
In-Reply-To: <e520357f-db43-4f61-a850-ee622aaf66f4@googlegroups.com>

On Friday, August 2, 2013 11:39:14 AM UTC-5, Graham Stark wrote:
> Hi,
>    if I have (say):
> 
> type Person is interface;
> 
> and I want to declare a collection of Person, how can I declare the type I'd need? I've tried:
> 
> type PA is array(1..2) of Person;
> 
> or
> 
> package PV is new Ada.Containers.Vectors( Positive, Person );
> 
> and the same with 'Class.
> 
> Graham

An "interface" type is an abstract type, so objects can not be declared using it.  You need to declare a derived type:

   type Human is new Person with ...;
   type HA is array(1..2) of Human;

-- Eryndlia (KK1T)

  reply	other threads:[~2013-08-02 16:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-02 16:39 How can I declare a collection of an interface? Graham Stark
2013-08-02 16:53 ` Eryndlia Mavourneen [this message]
2013-08-02 18:28 ` Adam Beneschan
2013-08-03  8:04   ` Graham Stark
replies disabled

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