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.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d84bea4ad7f9234a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-06 06:49:35 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator-dallas!news-in-dallas.newsfeeds.com!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: Subject: Re: Package Question [Newbie] Message-ID: X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Fri, 06 Jul 2001 09:49:25 EDT Organization: http://www.newsranger.com Date: Fri, 06 Jul 2001 13:49:25 GMT Xref: archiver1.google.com comp.lang.ada:9546 Date: 2001-07-06T13:49:25+00:00 List-Id: In article , JM says... >I'm still very green wrt to Ada but after looking at few tutorials a >have a couple of quick questions/observations. My background is C++ so >I'm grasping for commonalities. > >1. It looks as though basically the package is a class? No. The closest analog in C++ is the "namespace" feature. The closest analog Ada has for a C++ class is a tagged type inside a package (you need both). >2. And from a C++ point of view the package procedures are static >functions that operate on references to the package? So basically >'this' doesn't exist? No. Probably the best analogy is to a (non class-based) function inside a namespace. It is true however, that "this" doesn't exist. When you are calling dispatching operations in Ada, the object that is dispatched on (actually, there can be more than one), is passed in just like any other parameter. If it makes you comfortable, you could always name the parameter "This". :-) It would probably be best to forget about C++ while you are learning Ada. There are some situations where you will find parallels, but it will mostly just mislead you. This is particularly the case with string handling, because Ada's string philosophy is *very* different from C's. I think Ada's way is more powerful (and certianly faster). But people who insist on using Ada strings the C way get very frustrated. --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html home email - mailto:dennison@telepath.com