comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@on2.com (Matthew Heaney)
Subject: Re: Two class-wide operands, but only one controlling
Date: 27 Nov 2002 09:25:29 -0800
Date: 2002-11-27T17:25:30+00:00	[thread overview]
Message-ID: <1ec946d1.0211270925.1593c67b@posting.google.com> (raw)
In-Reply-To: 3de0b9be$0$304$bed64819@news.gradwell.net

porton@ex-code.com (Victor Porton) wrote in message news:<3de0b9be$0$304$bed64819@news.gradwell.net>...
> 
> Not what I need. basically I have a container and an iterator.
> Both a derived (in my case I need this) from abstract container
> and abstract iterator. I need procedure like:
> 
> procedure Next
>   (C: Abstract_Container'Class; I: in out Abstract_Iterator'Class);
>   
> but this is an error as we have two controlling operands of
> different types :-( I cannot make one of these non class-wide
> as both a abstract.
> 
> It was simple in C++. Ada has disadvantages...

A virtual function can only be a class member function, which means it
can be virtual for only one class.

Either you have this:

class Container
{
public:
   class Iterator { ... };

   virtual void next(Iterator&) const = 0;
...
};

Or you have this:

class Container
{
public:
   class Iterator 
   {
   public:
      virtual void next(const Container&) = 0;
      ...
   };
...
};


Both of which have a trivial conversion to Ada95.  So what is the
problem, exactly?



  parent reply	other threads:[~2002-11-27 17:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-23 16:10 Two class-wide operands, but only one controlling Victor Porton
2002-11-23 19:50 ` Pascal Obry
2002-11-24  8:27 ` Victor Porton
2002-11-24  8:59   ` Samuel Tardieu
2002-11-24 11:34 ` Victor Porton
2002-11-24 21:56   ` Pascal Obry
2002-11-25 22:17   ` Matthew Heaney
2002-11-27 17:25   ` Matthew Heaney [this message]
2002-11-25 19:19 ` Matthew Heaney
replies disabled

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