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,961b968d014d8843 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-23 02:41:04 PST Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!udel!news.mathworks.com!uunet!pipex!news.oleane.net!oleane!jussieu.fr!univ-lyon1.fr!swidir.switch.ch!epflnews!dinews.epfl.ch!lglsun!nebbe From: nebbe@lglsun.epfl.ch (Robb Nebbe) Newsgroups: comp.lang.ada Subject: Re: Ada Objects Help! Date: 23 Jan 1995 10:41:04 GMT Organization: Ecole Polytechnique Federale de Lausanne Sender: nebbe@lglsun3.epfl.ch (Robb Nebbe) Distribution: world Message-ID: <1995Jan23.111646@lglsun.epfl.ch> References: <3f9g1u$j4m@nps.navy.mil> <1995Jan16.132400@lglsun.epfl.ch> <1995Jan20.134150@hobbit> NNTP-Posting-Host: lglsun3.epfl.ch Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: 1995-01-23T10:41:04+00:00 List-Id: In article <1995Jan20.134150@hobbit>, hathawa2@marshall.edu (Mark S. Hathaway) writes: |> Then the Ada example changes 'myclass(int)' to 'Create(X : Integer) return T' |> with the added complexity of defining T. It looks wrong or overly complex. |> And it's comparable in length to the C++ version only because the class |> implementation isn't given. Ada doesn't have constructors so a function returning the type is what you would use. Defining T isn't any more complex it is just longer. Ada provides a more general approach by separating types and modules. To get the same level of generality C++ has nested classes. |> Does the Ada example even create an object? Yes, but not on the heap. |> Here's my idea of how it should look. (example deleted) I don't see any big difference. You have a complete separation of implementation and interface but that implies that you are going to work with more levels of indirection or you are going to perform what is often considered as code generation at link time. There are many aspects of both Ada and C++ that are in the language not so much because they are the best way to do it from some theroretical perspecitve but because of practical reasons such as "what do compiler writers know how to do well?" and "what do operating systems currently support?" Robb Nebbe