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 X-Google-Thread: 103376,5f0f4bfb0467bb19 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.11.199 with SMTP id s7mr47662100pbb.5.1317411738815; Fri, 30 Sep 2011 12:42:18 -0700 (PDT) Path: lh7ni8507pbb.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: "Rego, P." Newsgroups: comp.lang.ada Subject: Re: Constructors with multiple inheritance Date: Fri, 30 Sep 2011 12:42:18 -0700 (PDT) Organization: http://groups.google.com Message-ID: <24109204.1491.1317411738432.JavaMail.geo-discussion-forums@yqnv12> References: <11513972.2788.1317325228383.JavaMail.geo-discussion-forums@yqnv12> <1rj1mmkvwud1d.dzqoy4jhdfca$.dlg@40tude.net> <4976045.4489.1317352313370.JavaMail.geo-discussion-forums@yqjw35> <2pu3h5hqltxi$.ze4yrf1f2y8z.dlg@40tude.net> <23774546.1654.1317391464047.JavaMail.geo-discussion-forums@yqnk41> <1gnrks1djlaok.1k0r5f8z9ylfx.dlg@40tude.net> Reply-To: comp.lang.ada@googlegroups.com NNTP-Posting-Host: 200.148.121.121 Mime-Version: 1.0 X-Trace: posting.google.com 1317411738 8158 127.0.0.1 (30 Sep 2011 19:42:18 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 30 Sep 2011 19:42:18 +0000 (UTC) Cc: mailbox@dmitry-kazakov.de In-Reply-To: <1gnrks1djlaok.1k0r5f8z9ylfx.dlg@40tude.net> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=200.148.121.121; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu User-Agent: G2/1.0 X-Google-Web-Client: true Xref: news1.google.com comp.lang.ada:18246 Content-Type: text/plain; charset=ISO-8859-1 Date: 2011-09-30T12:42:18-07:00 List-Id: > Because null cannot be dereferenced. If you want null allowed you have to > declare it as: > function Construct (Object_Reference : access Parent_Class) > return Parent_Class_Ptr; > or > function Construct (Object_Reference : Parent_Class_Ptr) > return Parent_Class_Ptr; > The first variant is a "method" of Parent_Class in the first argument. The > second variant is not. Maybe it's a good idea :-) . The first variant I guess could fit me very well, and I did not think about it before. > Technically you cannot inherit class. Class is a set of types closed upon > derivation. When you derive type S from type T, then S and T are members of > the class rooted in the type T. S inherits operations etc from T. > What in C++ is called class is in Ada a tagged type and/or a class-wide > type, because C++ fails to distinguish them. > 1. In Ada access is based on visibility, which in turn rely on the packages > structure, not types. > 2. Inheritance and overriding is related to tagged types. You can always > derive from a type which view is tagged. (A type can be privately tagged, > but publicly not, from this type you cannot derive) Ok. I follow you. > Prefix notation works only if you have the first argument of tagged type. > The questions are why do you need an argument which is null? Why do you > need access types at all. It does not look how things are usually done in > Ada. Well, I'm trying to implement a kind of finite group for using with an AI algorithm. So I need to construct an empty queue (filled when the system starts) which points to other types of empty queues but which are been filled when the system learns. > >> What is wrong with the abstract factory pattern? > > > > Nothing wrong. I'm not questioning this. > > So why don't you use it? A good point. No reason at all. Maybe it can simplify some things. -- Dmitry and Bob, thank you for always helping me in my Ada learning. I'm very grateful (for you and others I did not cite here or the list would be very long).