[comp.lang.ada] Help on Inheritance

mark@BUDDY.CSS.GOV (Mark Nelson) (12/07/88)

--Question:

--I am working on a method for inheriting procedures, types and packages 
-- from within an Ada prospective. I am developing
-- a full Ada toolkit that will use the previously defined Ada binding to
-- the X Window System. I seem to run into a problem exploiting the idea of
-- nested generics and visibility. 
--
-- I am requesting help from other programmers that have used OOD in their
-- design and used inheritance. Can it be done, or is it only a mirage
-- from the Ada world.
--
-- I am trying to make the elemnents of a specific package visible within a
-- package that is nested two levels down.
--
-- Enclosed is an example of what is being attempted. I'm not sure I 
-- fully have the concept down so be kind.
------------------
package Xt_Super is
  generic
  package Super is
    
    type This_Type is (One, Two, Three);
  end Super;
end Xt_Super;

------------------

with Xt_Super;
package Xt_Sub_Class is
  
  generic
  package Sub_Class is
    
    package Super_Class is new Xt_Super.Super;
    use Super_Class;
    
    type This_Rec is 
      record
        First_Element : This_Type;
      end record;
    
  end Sub_Class;
end Xt_Sub_Class;
-------------------
--vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
--and on to the problem
--vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
with Xt_Sub_Class;
package Xt_My_Class is
  
  generic
  package My_Class is
    
    package New_Super_Class is new Xt_Sub_Class.Sub_Class;
    use New_Super_Class;
    
    type New_Record is 
      record
        The_Element : This_Type; --PROBLEM, How do I make this visible;
      end record;
  end My_Class;
  
end Xt_My_Class;


--I am trying to make pieces visible that should have a way to be done.
--Being pretty sure that this should be able to be done some how, I
--turn to my fellow programmers. I am sure I am missing something? But what?
--
--Please reply directly and I will post solutions to this inheritance
--problem once I figure it all out.
--
--Thanks for the flame mom!
--
--
--      ____  _         ____
--     /   / / |    /  /   /
--    /___  /__|   /  /
--       / /   |  /  /
--  /___/ /    | /  /____/
--   
--Mark A. Nelson                    |
--Geophysics Division               |  {ucbvax!ucsd,uunet!seismo}!esosun!mark
--Science Applications Int'l Corp.  |  esosun!mark@seismo.css.gov
--San Diego, CA                     |