From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,98f446539174ef31,start X-Google-Attributes: gid103376,public From: wanker@exploited.barmy.army Subject: OOP & Packages in Ada Date: 1998/01/30 Message-ID: <6asp37$q8b$1@Masala.CC.UH.EDU>#1/1 X-Deja-AN: 320569082 Originator: punkrock@pegasus Organization: The Exploited Barmy Army Newsgroups: comp.lang.ada Date: 1998-01-30T00:00:00+00:00 List-Id: Hey all, I've got a question for you. Assuming we have two packages, say Parents and Children, and Children contains a type, Child, that is inherited from a type in Parents (Parents.Parent), is there a way to easily make all the methods of Parents.Parent available to Child, so that just with'ing the Children package will make these methods available? Wrapper functions/procedures or renaming might do this, but is there an easier way? Here is an example of what I'm talking about: [Possibly incorrect Ada source follows, but you get the picture] In package Parents, there exists the following declarations: type Parent is tagged record ... end record; function X (P : in Parent'Class) returns Integer; procedure Y (P : in out Parent'Class); procedure Z (P : out Parent'Class); And in package Children there exist the following: type Child is new Parents.Parent with record ... end record; Now let's say we have a main program that withs both of these packages, so we have something like: procedure Main is P : Parents.Parent; C : Children.Child; begin Parents.X (P); Parents.X (C); end Main; Now, one problem with this code, is that the user seems to have to know that the method X for C is located in an entirely different package. Is there a way to have the package Children inherit the methods of its parents and make them visible so they act like it's own? In other words, is there a way that we can easily make it so that we can say: Children.X (C); Instead of: Parents.X (C); Without having to do stuff like renaming every function inside the child? Thanks