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,8b95e4156b22b891 X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Constructors? Date: 1998/08/27 Message-ID: #1/1 X-Deja-AN: 385201589 Sender: matt@mheaney.ni.net References: <35DF0616.77764632@tech.swh.lv> NNTP-Posting-Date: Thu, 27 Aug 1998 00:55:22 PDT Newsgroups: comp.lang.ada Date: 1998-08-27T00:00:00+00:00 List-Id: franke@minet.uni-jena.de (Frank Ecke) writes: > Yes, you can call a superclass constructor from a descendent class > constructor. But beware, although the term constructor exists in Ada, > it should not be confused with the notion used in OO. For example, in > Java, constructors are not inherited by the subclass. In Ada, a > constructor is simply a primitive operation of a tagged type and, > therefore, it is propagated into the subclass. Not necessarily. In fact, the usual rule of thumb is declare constructors so that they are NOT primitive operations of the type. You can do this be declaring the constructors in a nested package, or just return the class-wide type as the return value. One time when you do want to make the constructor primitive is when you need it to dispatch, as in the case of a factory method.