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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,c890e6ab3fb2c5fc X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,c890e6ab3fb2c5fc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-24 17:26:22 PST Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!udel!gatech!howland.reston.ans.net!news.moneng.mei.com!uwm.edu!lll-winken.llnl.gov!taurus.cs.nps.navy.mil!nps.navy.mil!usenet From: swdecato@nps.navy.mil Newsgroups: comp.lang.ada,comp.lang.c++ Subject: Re: ADA Objects Help! Date: 25 Jan 1995 01:26:22 GMT Organization: OS2 Sig Leader Message-ID: <3g49bu$7fv@nps.navy.mil> References: <3f9g1u$j4m@nps.navy.mil> <3flk3r$8qj@gdls.com> <3fu6qc$pc5@gnat.cs.nyu.edu> <3g3uc0$hm6@watnews1.watson.ibm.com> Reply-To: swdecato@cs.nps.navy.mil NNTP-Posting-Host: slb123.cc.nps.navy.mil X-Newsreader: IBM NewsReader/2 v1.03 Xref: nntp.gmd.de comp.lang.ada:18307 comp.lang.c++:88000 Date: 1995-01-25T01:26:22+00:00 List-Id: I started this discussion on the comp.lang.ada news group and was pleasantly surprised to see that it had migrated here... I am a new Ada student, so correct me if I make any glaring mistakes. Your sample code attempts to mimic a C++ class using a package. The problem with the package implementation is that I can't instantiate instances of the object at run time. In Ada, a pointer to a package is created at compile time since the declaration using the "new" operation occurs prior to the firt BEGIN. From a syntax standpoint, Ada packages are as close to C++ classes as you can get, minus the dynamic allocation. Many Ada folks have demonstrated how Ada objects are created and deleted. My argument against the Ada style was that I felt that the C++ syntax more accurately modelled the englist language. I have no doubt that the same effect can be achieved with either language. I still say that the following code is easier to understand when dealing with objects... MY_TYPE *objectPtr = new MY_TYPE; objectPtr->run(); objectPtr->sleep(); objectPtr->move(); objectPtr->Set(A,B); etc In Ada the same program would be: Run(objectPtr); Sleep(objectPtr); Move(objectPtr); Set(objectPtr, A, B); I don't see how passing "structs" to static functions differs from any other function which takes a parameter. In my mind, when I create a pointer to an object of some user defined class, that one pointer takes any public data and functions associated with the class.