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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,169758d7f087ac5b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-09 20:07:08 PST Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!rutgers!delphi.cs.ucla.edu!not-for-mail From: jmartin@oahu.cs.ucla.edu (Jay Martin) Newsgroups: comp.lang.ada Subject: Re: C++ Envy Date: 9 Jan 1995 20:07:08 -0800 Organization: UCLA Computer Science Dept. Message-ID: <3et15c$au2@oahu.cs.ucla.edu> References: <3eh9ak$q3g@Starbase.NeoSoft.COM> <3eju61$3kn@nic.umass.edu> NNTP-Posting-Host: oahu.cs.ucla.edu X-Newsreader: NN version 6.5.0.b3.0 #8 (NOV) Date: 1995-01-09T20:07:08-08:00 List-Id: yang@twain.ucs.umass.edu (Huayong YANG) writes: :SBS Engineering (progers@Starbase.NeoSoft.COM) wrote :: Tired of hearing about all those things that C++ can do that Ada87 can't? :: Then here's a cute trick in C++ that you'll like: :: #define private public :: #include compromised_class.h :: #define private private :: Confused? The above says that when compiling the class header for :: compromised_class, all the private stuff will be public, and thus :: available to the world. A friend showed me the above, and quoted the :: source as saying that eternal damnation was insufficient punishment... :: Hard to argue with. :Tell me how the above trick compromises the following class: :class T :{ : int an_item; :public: : int another; :}; :The data member an_item stays private, it seems to me. :-- :Huayong Yeah it won't but for large classes I expect most C++-ers will use: class T { public: ... private: ... }//T// style ala Coplien (Advanced C++:Prog Style and Idioms). This is due to that fact that users of the class do not want to have to skip over the top secret implementations details to get to the class interface (public methods) when reading the class. Of course the typical C programmers who get orgasms looking at super efficient implementation details may disagree. Thus, I suspect that this trick will work with most large classes. Jay