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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Experimenting with the OOP features in Ada Date: Thu, 5 Jan 2017 14:02:19 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <29380aa7-0c3b-4908-94c6-aa91f3996b42@googlegroups.com> <580eb363-2195-43f3-a589-b01657a1be43@googlegroups.com> NNTP-Posting-Host: s3c6wwRqkurrfTZpuYYZ+w.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:33068 Date: 2017-01-05T14:02:19+01:00 List-Id: On 2017-01-05 12:41, Laurent wrote: > On Wednesday, 4 January 2017 13:44:31 UTC+1, Dmitry A. Kazakov wrote: >> Object.Entity and Object.Archived.Deposit are already tagged. >> >>> > And that is why there is no place to put it? Or does abstract automatically > implies tagged? No. Object.Entity is derived from Ada.Finalization.Limited_Controlled which is tagged. [Tagged property is transitive upon derivation.] >> The package name Object gets hidden by the declaration the type Object. >> Change it to: >> >> type Object is abstract new Standard.Object.Entity ... >> > Why Standard? Thought that was for libraries which come preinstalled? I thought I > get access to Simple Components via Gnoga? Standard is the root package in Ada. So the full name of the package Object is Standard.Object. > So previous errors are gone, a new one: > > base_types-antibiotics.ads:30:9: type must be declared abstract or "Get_Class" > overridden > > So I looked at Get_Class. > > -- Get_Class -- Of an object > -- > -- Object - The object > -- > -- This function returns the class of Object. The class is a string > -- uniquely describing the object's type. It is analogous to external > -- type tag representation. Though, different types of objects may have > -- same class if necessary. > -- > -- Returns : > -- > -- The object class > -- > function Get_Class (Object : Deposit) return String is abstract; > > Hm is abstract, so no body to copy from. What is it doing? A persistent object must be stored externally. When you restore it you must know its Ada type. The string returned by Get_Class is the information you will use to get at that type. > If Object is of type ie.: Base_Type it will return a String with Base_Type? It is any text. See 2.4 and 2.4.2 for sample code. 2.4.2 implements a persistent binary tree of nodes. Each tree node is a separate persistent object. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de