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-Thread: 103376,7137ee7358078d09 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Basic Explaination of OO in Ada Date: 18 Sep 2006 13:51:24 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1158593087.194781.250030@e3g2000cwe.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1158601884 10409 192.74.137.71 (18 Sep 2006 17:51:24 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 18 Sep 2006 17:51:24 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news2.google.com comp.lang.ada:6640 Date: 2006-09-18T13:51:24-04:00 List-Id: richard.charts@gmail.com writes: > I'm new to Ada, having to learn it for work, and I am beginning to > understand the language, I think. > However, coming from C (and family) and Java and other "modern" > languages, I can't seem to wrap my head around Ada's OO methods. Is it > that there is simply nothing like a class in C++ or Java? Right. The things you can do are roughly the same, but they look rather different. In Ada, packages are all about visibility, encapsulation, information hiding, and so forth. Tageged and class-wide types are all about type extension and run-time polymorphism and so forth. C++ and Java combine all these things into one language feature -- the "class" -- whereas Ada splits them in two. Another unusual thing about Ada is the split between "specific type", which represents a particular point in the type heirarchy, and "class-wide type", which represents a whole [sub]hierarchy. > As a learning exercise, I'm trying to convert a simple Python program > to Ada. > The basics of the program were that it took in data about a Person > object(or Student or Advisor) and stored it into array for > manipulation. > At first, I kept trying to convert almost line for line to Ada. But I > couldn't build the classes in the same way. > Is the correct way to think in Ada, that in a package, there is some > record "object" and also a number of subprograms that can interact > with/on that record? Usually, for each abstraction, you have a package containing one main type, along with primitive operations on that type. - Bob