TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

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

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

Print Reply
"R. Ebert" <[log in to unmask]>
Reply To:
R. Ebert
Mon, 11 Aug 1997 12:37:22 +0200
text/plain (46 lines)
I have recently played around with the Booch Components
( and have tried to build a heterogenous
list of elements whose types are rooted at pl_element.

   type Pl_Element is tagged record
      Name     : Bounded_String;
      Distance : Long_Integer;
   end record;
   type Pl_Element_Ptr is access all Pl_Element;
   type Pl_Element_Class_Ptr is access all Pl_Element'Class;

   ... pl_element operations

   type Pump is new Pl_Element with record
      Power : Float;
   end record;

   ... pump operations

The generic interface of BC.Containers is

      type Item is private;
      type Item_Ptr is access all Item;
   package BC.Containers is

I hoped to instatiate BC.Containers with Pl_Element and
Pl_Element_Class_Ptr in order to build a DList of objects taht are
derived from Pl_Element.  But that is not possible (the way I intended
it to do).

Is it possible to build heterogenous container classes with the booch
componants?  How does one has to do it?

What is the rationale for not using something like

      type Item is tagged private;
      type Item_Ptr is access all Item'Class;
   package BC.Containers is

        [log in to unmask]