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,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,324453f076c10aeb,start X-Google-Attributes: gid103376,public From: "David Botton" Subject: Exposing agreggate members of a class Date: 1998/12/30 Message-ID: <76cd39$21c8$1@news.gate.net>#1/1 X-Deja-AN: 427012371 Organization: CyberGate, Inc. X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 Newsgroups: comp.lang.ada Date: 1998-12-30T00:00:00+00:00 List-Id: Given: with GCanvas_Package; use GCanvas_Package; type GWindow_Object is tagged with private; type GWindow_Pointer is access all GWindow_Object; private: type GWindow_Object is tagged record Canvas : GCanvas_Object; end record; What is the cleanest way to give access to the Canvas by reference in a way that will not require Unchecked Programming What I don't want: function Get_Canvas( window : in GWindow_Object ) return GCanvas_Pointer is begin return window.Canvas'Unchecked_Access; end Get_Canvas; Which on top of the Unchecked_Access issue means that consumers of such a class would have to dereference first to use the GCanvas_Object methods: declare Canvas : GCanvas_Pointer := Get_Canvas( window ); begin Draw_Line(Canvas.all, 10, 10, 100, 100); end; Of course you could write the methods to accept GCanvas_Pointer's, but I want to avoid the use of Access variables when possible. Thanks, David Botton