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,81cf52699486abe7 X-Google-Attributes: gid103376,public From: Hyman Rosen Subject: Re: Ada95 Strengths/Weaknesses. Date: 1999/09/27 Message-ID: #1/1 X-Deja-AN: 530077267 Sender: hymie@calumny.jyacc.com References: <37EED7B8.245C0054@yukyonline.co.yuky> <37EF9B98.7F817CC0@pwfl.com> Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@panix.com X-Trace: news.panix.com 938475966 20134 209.49.126.226 (27 Sep 1999 23:46:06 GMT) Organization: PANIX Public Access Internet and UNIX, NYC Mime-Version: 1.0 User-Agent: Gnus/5.070096 (Pterodactyl Gnus v0.96) Emacs/20.3 NNTP-Posting-Date: 27 Sep 1999 23:46:06 GMT Newsgroups: comp.lang.ada Date: 1999-09-27T23:46:06+00:00 List-Id: Marin David Condic writes: > On my web page (see trailer) I have started a page which compares Ada and > C++ code examples to illustrate how different OODesign features are > implemented in both languages. It isn't too far along just yet, but I > anticipate it growing over the next several weeks. You may find it > interesting to look at this comparison. I found it very interesting. It crystalizes why so many people prefer to write in C++ rather than Ada! Aside from the verbosity of the Ada code (which is apparent even though the C++ equivalents aren't written idiomatically), notice that in the output code, it is necessary to repeat the types of the things being output, even though the ompiler already knows it! By the way, here's the C++ for your unimplemented third case - #include #include using namespace std; class SaveStuff { string name; int save; public: Save_Stuff(string n = string(), int s = 0) : name(n), save(s) { } void put(int x) { save = x; } int get() const { return save; } }; int main() { SaveStuff my_obj("My Object", 55); SaveStuff your_obj("Your Object", 55); my_obj.put(23); cout << "The value of my object is " << my_obj.get() << endl; your_obj.put(46); cout << "The value of your object is " << your_obj.get() << endl; }