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-Thread: 103376,100eb0a59892e906 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!164.128.36.58!news.ip-plus.net!newsfeed.ip-plus.net!news.post.ch!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: How to pass around access types to interfaces? Date: Wed, 29 Oct 2008 15:15:20 +0100 Organization: Swisscom IP+ (post doesn't reflect views of Swisscom) Message-ID: <49086ff8$1@news.post.ch> References: <8bd7e8eb-b463-4dea-8b62-42b6486557f0@u65g2000hsc.googlegroups.com> NNTP-Posting-Host: 194.41.146.1 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: atlas.ip-plus.net 1225289724 5832 194.41.146.1 (29 Oct 2008 14:15:24 GMT) X-Complaints-To: abuse@ip-plus.net NNTP-Posting-Date: Wed, 29 Oct 2008 14:15:24 +0000 (UTC) User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) In-Reply-To: <8bd7e8eb-b463-4dea-8b62-42b6486557f0@u65g2000hsc.googlegroups.com> X-Original-NNTP-Posting-Host: w03duo.pnet.ch X-Original-Trace: 29 Oct 2008 15:15:20 +0200, w03duo.pnet.ch Xref: g2news2.google.com comp.lang.ada:8252 Date: 2008-10-29T15:15:20+01:00 List-Id: Maciej Sobczak schrieb: > On 26 Paź, 16:50, "Martin Krischik" > wrote: > >> But then: access to class wide is the kind of >> access which a C++ convert will uses without realy needing them. I should >> know, I am a C++ convert who made precisely that mistake. > > It might depend on what you did in C++ before converting. ;-) > Since most of the code does not need pointers anyway, the frequent > idiom is to pass objects by reference (likely to the base class), > something like: > > void foo(const SomeClass & object); Not the function call is the problem - the creation and storage of objects is. For example: now are you going to fill a vector with objects? And how do you delete those objects again? This is where C++ lags. In Ada we have Ada.Container.Indefinite_Vector which can hold Base'Class objects. (Remember that is was me who requested the inclusion of Ada.Container.Indefinite_Vector into the standard. It was also me who created BC.Indefinite_Containers) > I think that in the above context what is *really* dangerous and > difficult to clean up is the C background, not C++. Unfortunately the > former one prevails. Well I did C before C++ and Modula-2 before that and Pascal before that. Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com