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,31b0987544f45da7 X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: inheritance and private overiding Date: 2000/05/04 Message-ID: #1/1 X-Deja-AN: 619217519 Sender: bobduff@world.std.com (Robert A Duff) References: Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 2000-05-04T00:00:00+00:00 List-Id: tmoran@bix.com writes: > One compiler refuses to compile this code, giving the indicated > error message. Other compilers accept it just fine and print > "in test1" then "in test2". Who's right? I don't see anything illegal in this program. But I could be missing something. - Bob > ----------------- > package test1 is > type Root is tagged null record; > procedure P(X : in out Root); > end test1; > > with ada.text_io; > package body test1 is > procedure P(X : in out Root) is > begin > ada.text_io.put_line("in test1"); > end P; > end test1; > > with test1; > package test2 is > type Branch is new test1.Root with private; > private > type Branch is new test1.Root with null record; > procedure P(X : in out Branch); > end test2; > > with ada.text_io; > package body test2 is > procedure P(X : in out Branch) is > begin > ada.text_io.put_line("in test2"); > end P; > end test2; > > with test1, test2; > package test3 is > type A is new test1.Root with null record; > type B is new test2.Branch with null record; > end test3; > > with test3; > procedure test is > X : test3.A; > Y : test3.B; > begin > test3.P(X); > test3.P(Y); -- One compiler says "expected type A, found type B" > -- others have no complaints > end test;