Re: generic unit : compilation error ! please help me
- From: Stephen Leake <stephe_on_the_web@xxxxxxxxxxxx>
- Date: Fri, 24 Feb 2006 05:51:14 -0500
nblanpain@xxxxxxxxxxx writes:
hello,
When i compile the following programm, i have the following error on
function Set_Unit_To_Test of class "child-test_unit.adb" :
"14 : invalid tagged conversion, not compatible with type T_Child'Class
defined at child.ads"
I don't undestand this error : please help me !
## parent.ads ## :
minor point; please use Ada comments for separators like this, so
gnatchop can handle them.
generic
type T_Real is digits <>;
package Parent is
type T_Parent is tagged private;
type T_Parent_Access is access all T_Parent;
private
type T_Parent is tagged record
Real : T_Real;
end record;
end Parent;
I have not fully sorted out your problem, because I find the names too
confusing. While it is proper to have similar names like this in a
finished product, they do get in the way of finding structural
problems.
So first, do these steps:
1) Get rid of the subtypes; use the full type names. It will make
things clearer.
2) Name things clearly, without relying on the package name;
Parent_Class_Access_Type, Child_Class_Access_Type.
I think you have too many class-wide access types. In particular, I
think you are trying to store a parent unit test in an object of type
child unit test. The object probably needs to be of type
Parent_Class_Access.
The clearer names will help you sort out what you really want to do.
Once that is clear, you can change the names back to be more
user-friendly.
--
-- Stephe
.
- References:
- generic unit : compilation error ! please help me
- From: nblanpain
- generic unit : compilation error ! please help me
- Prev by Date: Re: GNAT GPL compile problems
- Next by Date: Re: generic unit : compilation error ! please help me
- Previous by thread: generic unit : compilation error ! please help me
- Next by thread: Re: generic unit : compilation error ! please help me
- Index(es):