TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Tom Moran <[log in to unmask]>
Sun, 22 Sep 2002 20:59:34 -0700
text/plain (23 lines)
>  type Active_Area_Access_Type is
>       access all Active_Area_Type'Class;
  I think you want to drop the "all".  You only need it if your access
value will point to non-allocated storage, ie, global memory or the
  X : aliased Active_Area_Type;
  Pointer_To_X : Active_Area_Access_Type := X'access;
You certainly wouldn't want to try to "free" a chunk out of global
memory.  The declaration
 type Active_Area_Access_Type is
      access     Active_Area_Type'Class;
means that Active_Area_Access_Type can *only* refer to things created by
"new", and they can be freed via Ada.Unchecked_Deallocation

> 1. When I create a derived class, the methods of that class have no
> direct assess to the attributes of the base class
  type Y is new X with private;
  Old_Size : constant Integer := X'size;
is perfectly legal.  Or do you mean something other than Ada
"attributes".  If, perhaps, you mean that the methods of Y should have
access to the private parts of X, then Y needs to be in the same, or a
child package of, X.