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: 103376,56131a5c3acc678e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-07 20:47:28 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!elnk-pas-nf1!elnk-nf2-pas!newsfeed.earthlink.net!newshub.sdsu.edu!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!intern1.nntp.aus1.giganews.com!nntp.giganews.com!nntp.rapidnet.com!news.rapidnet.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 07 Dec 2003 22:47:27 -0600 Date: Sun, 07 Dec 2003 22:42:22 -0600 From: Chad Bremmon Reply-To: bremmon@acm.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Question about OO programming in Ada References: <5JmdnUF_9o_ABE-iRTvUrg@rapidnet.com> <1273941.m4G3ZzughP@linux1.krischik.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.13.119.61 X-Trace: sv3-9iPdpxbZIXQ56xOzwR7wPGvAkNWjJqtpo4Z9RXibrnEoLtLeAJ1IqjFgUbEZ5TOLB9hofRxBtrvmg6q!7riDgyb65HNjgVaiFzGvgupKWViL+eSVSa4A7GdVNQfQzHD5oaBAivBQNTO9mwXFktTm6b78FGjL X-Complaints-To: abuse@rapidnet.com X-DMCA-Complaints-To: abuse@rapidnet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:3216 Date: 2003-12-07T22:42:22-06:00 List-Id: Hyman Rosen wrote: > James Rogers wrote: > >> I understood "virtual" is a modifier for C++ functions. A C++ class >> with non-virtual functions can still be extended with new data members, >> or even with new virtual function members. Please correct me if I am >> wrong. > > > A C++ class with no virtual functions (of its own or inherited) is the > equivalent of an untagged Ada type. A class with any virtual function Not true. A C++ Struct is the equivalent of an untagged Ada Type. The Ada encapsulation mechanism is making that Ada type private. > is the equivalent of a tagged type. The typical C++ implementation of > virtual functions (and I imagine the Ada one as well) is to include in Before a dispatch pointer is needed in Ada95, runtime polymorphism must be required. Otherwise, Ada95 always figures out the binding during compilation, because it always knows the type of the variable that is being passed to the appropriate function. To get to having runtime polymorphism, you must have a linked list of Tagged_Type'Class elements. Because Ada 95 is strongly typed, the compiler can figure out at compile time which function to call, based on the type. This ensures that dispatching is done during compile time. You still have the look and feel of polymorphism, without the non-deterministic nature of runtime dispatching. > the class a pointer to a dispatch table. While a C++ class has no virtual > functions, the compiler does not place such a dispatch pointer in the > class. When a virtual function is added, the compiler adds the dispatch > pointer. >