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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.98.26.8 with SMTP id a8mr67929377pfa.4.1470423554843; Fri, 05 Aug 2016 11:59:14 -0700 (PDT) X-Received: by 10.157.10.77 with SMTP id 71mr1355946otg.15.1470423554803; Fri, 05 Aug 2016 11:59:14 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!f6no7627939ith.0!news-out.google.com!d130ni25721ith.0!nntp.google.com!f6no7627934ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 5 Aug 2016 11:59:12 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=98.109.78.200; posting-account=h3IwYwoAAAAeE2lWQnRSCqcQ0dO-KDvQ NNTP-Posting-Host: 98.109.78.200 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: child class of limited_controlled not inheriting data From: b.mcguinness747@gmail.com Injection-Date: Fri, 05 Aug 2016 18:59:14 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:31297 Date: 2016-08-05T11:59:12-07:00 List-Id: I defined a base class as with Ada.Float_Text_IO; with Ada.Finalization; package sofa.time.two_part_date is type Date is new Ada.Finalization.Limited_Controlled with private; function To_Date (days : Integer; fraction : Real) return Date; function To_Date (time_string : String) return Date; function "<" (left, right : Date) return Boolean; function "<=" (left, right : Date) return Boolean; function "=" (left, right : Date) return Boolean; function ">=" (left, right : Date) return Boolean; function ">" (left, right : Date) return Boolean; procedure Add_Days (this : in out Date; days : in Integer; fraction : in Real); function Get_Day_Count (this : Date) return Integer; function Get_Day_Fraction (this : Date) return Real; function To_Real (this : Date) return Real; function To_String (this : Date) return String; private type Date is new Ada.Finalization.Limited_Controlled with record day_count : Integer; day_fraction : Real; -- Normalized to 0.0 <= x < 1.0 end record; overriding procedure Initialize (this: in out Date); overriding procedure Finalize (this: in out Date); procedure Normalize (day_count : in out Integer; day_fraction : in out Real); end; (It's Limited_Controlled because I want to force day_fraction to be normalized when objects of the class are created.) Then I defined a child class as with sofa.time.two_part_date; package sofa.time.Julian_Day_Numbers is type Julian_Day_Number is new sofa.time.two_part_date.Date with null record; function To_Julian_Day_Number (time : Instant) return Julian_Day_Number; function To_Calendar_Date (this : Julian_Day_Number; calendar : Calendar_Type := GREGORIAN; zone : Time_Zone_Number := 0) return Instant; function To_Milliseconds (this : Julian_Day_Number) return Integer; end sofa.time.Julian_Day_Numbers; When I try to compile the child class, I get error messages such as sofa-time-julian_day_numbers.adb:77:79: "day_count" is not a component of type "Julian_Day_Number" defined at sofa-time-julian_day_numbers.ads:4 indicating that the child class is not inheriting the data from the parent class. What is wrong here? Thanks. --- Brian