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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2fc95e32fd071218 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-27 09:25:30 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: mheaney@on2.com (Matthew Heaney) Newsgroups: comp.lang.ada Subject: Re: Two class-wide operands, but only one controlling Date: 27 Nov 2002 09:25:29 -0800 Organization: http://groups.google.com/ Message-ID: <1ec946d1.0211270925.1593c67b@posting.google.com> References: <3ddfa8b8$0$304$bed64819@news.gradwell.net> <3de0b9be$0$304$bed64819@news.gradwell.net> NNTP-Posting-Host: 66.162.65.162 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1038417930 4596 127.0.0.1 (27 Nov 2002 17:25:30 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 27 Nov 2002 17:25:30 GMT Xref: archiver1.google.com comp.lang.ada:31263 Date: 2002-11-27T17:25:30+00:00 List-Id: 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?