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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ec7ccf8eee6d37fc,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-16 10:31:21 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!cmnz-3e36fc21.pool.mediaways.NET!not-for-mail From: "Thomas Nebel" Newsgroups: comp.lang.ada Subject: virtual functions in ada95 Date: Sat, 16 Jun 2001 19:31:07 +0200 Message-ID: <9gg557$8sgga$1@ID-42131.news.dfncis.de> NNTP-Posting-Host: cmnz-3e36fc21.pool.mediaways.net (62.54.252.33) X-Trace: fu-berlin.de 992712679 9323018 62.54.252.33 (16 [42131]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Xref: archiver1.google.com comp.lang.ada:8805 Date: 2001-06-16T19:31:07+02:00 List-Id: Hi How can i use virtual functions in Ada? I have a superclass and some classes that are derived from it: type TNTGL_Custom_Node_Record is tagged null record; type TNTGL_Node_Record is new TNTGL_Custom_Node_Record with private; type TNTGL_Visual_Node_Record is new TNTGL_Node_Record with private; type TNTGL_Sphere_Record is new TNTGL_Visual_Node_Record with private; type TNTGL_Node is access all TNTGL_Node_Record'Class; type TNTGL_Sphere is access all TNTGL_Sphere_Record'Class; .... procedure Run (Node : access TNTGL_Node_Record'Class); procedure Run (Node : access TNTGL_Group_Node_Record'Class); procedure Run (Sphere : access TNTGL_Sphere_Record'Class); Now i want to "run" the classes from one point transparently : Node : TNTGL_Node; ... Node := Scene.First_Node; while Node /= null loop Run (Node); Node := Get_Next (Node); end loop; Independent of the real type of the Node variable, the Run function is always the Run from TNTGL_Node_Record. How can i manage it, that the Run function for the real Node type is called ? Thomas