comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Constructors with multiple inheritance
Date: Sat, 12 Nov 2011 17:28:54 +0100
Date: 2011-11-12T17:28:54+01:00	[thread overview]
Message-ID: <1sjf8p6n8qvi5.17sqiogpqnwx5.dlg@40tude.net> (raw)
In-Reply-To: 27371284.2333.1321111829701.JavaMail.geo-discussion-forums@yqhd1

On Sat, 12 Nov 2011 07:30:29 -0800 (PST), Rego, P. wrote:

>>   function Construct (aValue: Integer; aName: Integer)
>>                       return Par_Class is
>>   begin
>>     return (theValue => aValue,
>>             theName  => aName);
>>   end Construct;
> 
> In this case function Construct would behave as a C++ static function (or maybe a friend one?)?

That depends on what you mean. In Ada:

1. there is no hidden parameters

2. an operation can be dispatching (virtual) in any combination of
parameters and/or result. But an operation cannot be dispatching in more
than one type (no multiple dispatch). All tags of dispatching parameters
must be same (no multi-methods).

3. there is no static or friend operations as the visibility rules are
based on packages.

The function Construct above is a primitive operation, it is not a
constructor.

Constructors in Ada are implicit, they consist of

1. construction of the components (in an unspecified order, recursively);

2. a call to Initialize if the type is a descendant of
Ada.Finalization.[Limited_]Controlled. (Overridden bodies of Initialize are
not called! I.e. Ada constructors do not traverse derivation path. In
short, aggregation is safe, derivation is not;

3. starting all task components. (Note, tasks are not running when
Initialize is called!)

Destructors act in the reverse order: tasks - Finalize - components.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2011-11-12 16:28 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.
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 [this message]
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