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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a6ce7ddad9a820ed,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-03-08 02:44:58 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!pipex!dsbc.icl.co.uk!oasis.icl.co.uk!jerry.rb.icl.co.uk!not-for-mail From: skj@rb.icl.co.uk (Simon Johnston) Newsgroups: comp.lang.ada Subject: C++ to Ada95, help please Date: 8 Mar 1995 07:54:38 -0000 Organization: ICL Retail Systems,Bracknell,Berks,UK Message-ID: <3jjnru$e02@jerry.rb.icl.co.uk> NNTP-Posting-Host: jerry.rb.icl.co.uk X-Newsreader: TIN [version 1.2 PL2] Date: 1995-03-08T07:54:38+00:00 List-Id: Hi, I am moving over to Ada95 from C++, I did do some Ada a while ago, and I am fairly confident, but I need some help to move some C++ knowledge onto Ada95. First I would like to declare an Opaque type, or in C++ a 'smiley'. There are two uses for such a feature. First, where a class' implementation may change greatly, and I want to really hide this from clients I would declare a class for the implementation and hide it. C++ allows this as if you only use a pointer to the opaque type then the compiler knows the size of it and does not need to know more. The second is where you have some information that the client may request, but the client can only use it by passing it back to you. I have used this in a text screen class to save and restore the screen contents, the client cannot manipulate the screen object as they cannot know what it is, and as the screen object is platform dependant I can use a completely different implementation behind the scenes. I include two examples below to illustrate. // Start -> class ACollectionClass { public: ... private: class Implementation; Implementation* hidden; }; class Screen { public: ... class SavedScreen; const SavedScreen* save(void); void restore(SavedScreen* image); }; // <- end. Now I know from experience I can do this sort of thing in C++, Modula-2 and Modula-3 but I cannot see how to do it in Ada, even using private types. Thanks very much. MODULE Sig; FROM ICL IMPORT StdDisclaimer; FROM Interests IMPORT Modula2, Modula3, Linux, OS2; BEGIN (* ------------------------------------------------------------------------. |Simon K. Johnston - Development Engineer (C/C++) |ICL Retail Systems | |------------------------------------------------------|3/4 Willoughby Road| |Unix Mail : S.K.Johnston@bra0801.wins.icl.co.uk |Bracknell, Berks | |Telephone : +44 (0)344 476320 Fax: +44 (0)344 476302|United Kingdom | |Internal : 7261 6320 OP Mail: S.K.Johnston@BRA0801|RG12 8TJ | `------------------------------------------------------------------------ *) END Sig.