From: "Rego, P." <pvrego@gmail.com>
Cc: mailbox@dmitry-kazakov.de
Subject: Re: Constructors with multiple inheritance
Date: Fri, 30 Sep 2011 12:42:18 -0700 (PDT)
Date: 2011-09-30T12:42:18-07:00 [thread overview]
Message-ID: <24109204.1491.1317411738432.JavaMail.geo-discussion-forums@yqnv12> (raw)
In-Reply-To: <1gnrks1djlaok.1k0r5f8z9ylfx.dlg@40tude.net>
> 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).
next prev parent reply other threads:[~2011-09-30 19:42 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-29 19:40 Constructors with multiple inheritance Rego, P.
2011-09-29 20:20 ` Dmitry A. Kazakov
2011-09-30 3:11 ` Rego, P.
2011-09-30 7:36 ` Dmitry A. Kazakov
2011-09-30 14:04 ` Rego, P.
2011-09-30 16:29 ` Robert A Duff
2011-09-30 19:14 ` Rego, P.
2011-09-30 16:42 ` Dmitry A. Kazakov
2011-09-30 19:42 ` Rego, P. [this message]
2011-10-06 12:46 ` Julian Leyh
2011-11-09 2:24 ` Rego, P.
2011-11-09 8:39 ` Dmitry A. Kazakov
2011-11-10 3:47 ` Rego, P.
2011-11-10 7:09 ` AdaMagica
2011-11-10 7:20 ` AdaMagica
2011-11-10 8:35 ` Dmitry A. Kazakov
2011-11-12 15:16 ` Rego, P.
2011-11-12 15:30 ` Rego, P.
2011-11-12 16:28 ` Dmitry A. Kazakov
2011-11-12 17:41 ` Rego, P.
2011-11-10 8:33 ` Simon Wright
2011-11-10 9:01 ` Georg Bauhaus
2011-11-10 9:09 ` Georg Bauhaus
2011-11-10 18:16 ` Jeffrey Carter
2011-11-10 19:39 ` Dmitry A. Kazakov
2011-11-09 9:00 ` Simon Wright
2011-11-10 3:54 ` Rego, P.
2011-10-07 0:08 ` Shark8
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox