From: Daniel <danielnorberto@gmail.com>
Subject: constructor in abstract tagged types
Date: Wed, 8 May 2019 11:37:23 -0700 (PDT)
Date: 2019-05-08T11:37:23-07:00 [thread overview]
Message-ID: <0ca05176-a819-4e9a-8c6c-3a0c1f32f964@googlegroups.com> (raw)
Hello, im trying to know how can i use abstract tagged types and constructors at the same time.
I have this
package FATHERS is
type Father is abstract tagged record
Years : Natural;
field1 : Natural;
-- .....and 15 more fields
end record;
function F_build(Years :Natural) return Father is abstract;
procedure F_forced_to_do_it is abstract;
end FATHERS;
package FATHERS.SONS is
type Son is new father with record
skate : boolean;
end Son;
function F_Build(Years :Natural) return Son;
procedure F_Forced_to_do_it;
end FATHERS.SONS;
package body FATHERS.SONS is
function F_Build(Years : Natural) return Son is
begin
¿?¿?¿?¿?¿?
end F_Build;
end FATHERS.SONS;
---------------------------------
So the question is How can i make the constructor F_Build of the Son?
Option 1:
return son'(Years => Years,
field1 => ¿?,
field2 => ¿?.
...
field15 => ?¿
Problem: put 15 fields by hand for every type of son.. really annoying.
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.
Regards,
Daniel.
next reply other threads:[~2019-05-08 18:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-08 18:37 Daniel [this message]
2019-05-08 19:26 ` constructor in abstract tagged types 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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox