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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,aac9c9d31ad3f02e,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-08-18 17:13:01 PST Path: supernews.google.com!sn-xit-02!sn-east!supernews.com!feed2.onemain.com!feed1.onemain.com!newsfeeds.belnet.be!news.belnet.be!news-ge.switch.ch!news.grnet.gr!el97165 From: el97165@central.ntua.gr (moasi) Newsgroups: comp.lang.ada Subject: Polymorfism Question Date: 19 Aug 2000 00:12:07 GMT Organization: National Technical University of Athens Message-ID: Reply-To: azisi@cc.ece.ntua.gr NNTP-Posting-Host: ppp113.dialup.ntua.gr X-Trace: foo.grnet.gr 966643927 4719 147.102.223.113 (19 Aug 2000 00:12:07 GMT) X-Complaints-To: abuse@ntua.gr NNTP-Posting-Date: 19 Aug 2000 00:12:07 GMT User-Agent: slrn/0.9.5.7 (UNIX) Xref: supernews.google.com comp.lang.ada:195 Date: 2000-08-19T00:12:07+00:00 List-Id: I have a linked list. And i have done several classes and subclasses. So i create objects of different classes and make a heterogeneous list. Now i want to print the list. Each element in list has different fields, so when i ask for the list i don't get all the fields but just the basics. How can i alter that? Here is my program: procedure Print_All_Obligations(MyList: access List) is Current_Ptr : Obligation_Ptr; CheckMyList : Integer_Check; begin Reset_Cursor(MyList); Current_Ptr := Obligation_Ptr(Return_Cursor(MyList)); if Current_Ptr /= null then begin Print(Current_Ptr); loop CheckMyList := Go_Next_Element(MyList); exit when CheckMyList /= 0; New_Line; Current_Ptr := Obligation_Ptr(Return_Cursor(MyList)); Print(Current_Ptr); end loop; end; else Put_Line ("--> Nothing In List!"); end if; New_Line; end Print_All_Obligations; The classes starting for the top are: element --> obligation --> meeting --> b_meeting and p_meeting the last 2 are in the same level (they both have meeting as their parent). All classes except the element have a print, and when i call the print of b_meeting, it prints something then calls the print of meeting and the print of meeting calls the print of obligation. I have also declared pointers for each class like that type Element_Ptr is access all Element'Class; In general how can i understand each time in what kind of element am i so that i can print the correct fields? Please feel free to give any hints, remarks or advices! -- Antonis Zisimos