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,900edaa189af2033 X-Google-Attributes: gid103376,public From: cosc19z5@Bayou.UH.EDU (Spasmo) Subject: Re: Ada95 OOP Questions Date: 1996/07/30 Message-ID: <4tkbm8$oto@Masala.CC.UH.EDU>#1/1 X-Deja-AN: 170952400 references: <4tf3l4$4hu@masala.cc.uh.edu> <4tjaai$1hp@news.ida.org> organization: University of Houston newsgroups: comp.lang.ada Date: 1996-07-30T00:00:00+00:00 List-Id: [I've read Small, and think I actually learned something :) so I'm just posting here to check and also so no bandwidth is wasted on trying to help me out if I've already gotten this] David Wheeler (wheeler@aphrodite.csed.ida.org) wrote: : Andre Spiegel (spiegel@berlin.informatik.uni-stuttgart.de) wrote: : : Spasmo writes: [Snip] : : > Correct me if I'm wrong on this. So you're still passing parameters : : > which means that data and subprograms are still 2 different entities : : > which sorta hurts the abstraction, rather than in say C++ where : : > you've got a unified object. : : You _are_ wrong. The subprograms actually _are_ a part of the object, : : and they "go" with it, so to speak of, whereever you take the object. : : It is just less obvious from the syntax in Ada. I took your advice and looked at some of the OO parts of your "Small" program (Thing and its children), and I think I understand things now. In any case I'm going to go back and check out "Small" again, it looks like a cool program and studying it can teach me some valuable stuff! Here are things as I understand them (correct me if I'm wrong). I did a very simple parent class and a function accepting that parent class as an argument in a package. In another package I declared another class that inherited from the parent class but did nothing else. This package of course with'ed the parent package. I then wrote a program that with'ed the child package and called a function that wasn't defined in the child class, but in the parent class and it went through fine. What I'm concluding from this is that the functions are inherited and for this to happen a few things need to be met: 1) The package defining the parent class has to be visible 2) The package that with's the parent class declares a child class. 3) Any functions inherited are functions that take the parent class as an argument. So what it is is that a subprogram really does belong to a class, but the way we mark a subprogram as being a member of a class is if it accepts that class as one of its parameters right? So we're still passing objects to subprograms but inheritance, etc... are in fact performed, it's just the arguments that "tag" (loose use of this term) a subprogram as a class method and imply inheritance into other packages. If I'm incorrect on any of this or if anyone wants to add in I'm all ears. I hope I got it right because it's starting to make sense :) : Spiegel's right. Spasmo - you're concentrating on minor syntactic variance. : Ada treats all calls with the same syntax; C++'s syntax varies depending : on how it's defined. The difference is unimportant. Well this variance had me genuinely confused so I didn't see the true nature of OOP in Ada95. : To see an example of OO in Ada95, look at my "Small" program at: : "http://lglwww.epfl.ch/Ada/Tutorials/Lovelace/small.htm" : You'll see lots of OO concepts, and operations unified with the object. Yep I looked at your "Small" program and if what I said above is on the mark, then it's finally gotten me to realize what you poor folks have been trying to drive into my thick skull. : --- David A. Wheeler : Net address: dwheeler@ida.org -- Spasmo "Everyone has secrets, but sometimes you get caught, So if it's just between us, my silence can be bought" "Blackmail" by Sloppy Seconds