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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8054919d7e55838b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!atl-c08.usenetserver.com!news.usenetserver.com!pc02.usenetserver.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Q: Hiding the structure of a tagged type using containers References: <1147139575.425825.290860@u72g2000cwu.googlegroups.com> From: Stephen Leake Date: Tue, 09 May 2006 02:43:41 -0400 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:1GSK0wG9StKgSK00g9Re5aFeR1A= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 8283d44603a2ce73ae4a407011 Xref: g2news2.google.com comp.lang.ada:4147 Date: 2006-05-09T02:43:41-04:00 List-Id: brian.b.mcguinness@lmco.com writes: > I am trying to create a tree of object classes to represent arrays. > I want to hide the internal representation of the arrays in the > private sections of the packages for the tagged types. However, I am > having trouble figuring out how to do this. For example, I have an > abstract base class called APL_Array, and I am trying to create a > child class called APL_Array_Dimensioned that contains a list of > dimensions (which may change over time, say if someone concatenates > a row or column to a matrix). I used to use APL! fun language :). > > > but when I try to compile it, I get: > > # gnatmake -gnat05 apl-arrays-dimensioned.adb > gcc -c -gnat05 apl-arrays-dimensioned.adb > apl-arrays-dimensioned.ads:21:13: operation can be dispatching in only > one type The general solution to this error is to make one of the arguments class-wide; in this case: procedure Shape (A : in APL_Array_Dimensioned; Dimensions : out APL_Shape'class); or procedure Shape (A : in APL_Array_Dimensioned'class; Dimensions : out APL_Shape); If children of APL_Array_Dimensioned don't need to override Shape, the second declaration is more appropriate. Another solution is to use only one tagged type. Apparently APL_Dimension_List.Vector is visibly tagged; perhaps it does not need to be? -- -- Stephe