comp.lang.ada
 help / color / mirror / Atom feed
From: Daniel <danielnorberto@gmail.com>
Subject: Re: constructor in abstract tagged types
Date: Sat, 18 May 2019 04:43:38 -0700 (PDT)
Date: 2019-05-18T04:43:38-07:00	[thread overview]
Message-ID: <de5c4fef-c4b8-4cda-abfd-9d42112b06f6@googlegroups.com> (raw)
In-Reply-To: <qb4ule$3gs$1@franka.jacob-sparre.dk>

El sábado, 11 de mayo de 2019, 0:40:48 (UTC+2), Randy Brukardt  escribió:
> "Daniel" wrote in message 
> ...
> ...
> >Option 2:
> >
> >  return Son'(Father with
>  >              Skate =>True);
> >
> >Problem: i cannot initialize Father or call any kind of constructor of 
> >Father
> >becouse compiler don't let me make any kind of function of a abstract 
> >tagged type.
> 
> Correct. But that's what you declared in this case, so I would assume that 
> you want to manually initialize all of the components.
> 
> If you have proper default values for the components, why not declare the 
> Father type that way?? Uninitialized stuff often leads to trouble anyway.
> 
> That is:
> 
>   type Father is abstract tagged record
>      Years : Natural := 0;
>      field1 : Natural := 0;
> --    .....and 15 more fields
>   end record;
> 
> If you *don't* want this sort of default value, then it only makes sense to 
> initialize all of the components when the object is first created. (Or you 
> could define a procedure to do it, as Dmitry showed. But you lose 
> completeness checking when you do that.)
> 
>                                     Randy.

Thank you for your answer.
Yes. In the real component i will want to initialize to some known value for some attributes, but there are other that i need to change from the son constructor.


      reply	other threads:[~2019-05-18 11:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 18:37 constructor in abstract tagged types Daniel
2019-05-08 19:26 ` Dmitry A. Kazakov
2019-05-18 11:31   ` Daniel
2019-05-08 20:50 ` Jere
2019-05-10 22:35   ` Randy Brukardt
2019-05-09 14:40 ` AdaMagica
2019-05-10  4:46   ` Petter Fryklund
2019-05-18 11:35   ` Daniel
2019-05-10 22:40 ` Randy Brukardt
2019-05-18 11:43   ` Daniel [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox