From: "Rick Santa-Cruz" <rick_santa_cruz75@msn.com>
Subject: access private element of base-class
Date: Fri, 1 Oct 2004 02:35:22 +0200
Date: 2004-10-01T02:35:22+02:00 [thread overview]
Message-ID: <cji8ru$jtf$02$1@news.t-online.com> (raw)
Hi,
again something with Ada is unclear to me. In the thread:
http://groups.google.de/groups?q=ada+protected+c%2B%2B&hl=de&lr=&ie=UTF-8&selm=slrn8ljk2n.qv2.gisle%40struts.ii.uib.no&rnum=6
I read, that the Ada-private is more similar to protected than to C++
private, so I tried the following:
-- specification of Base-Class
package Base_Class is
type Base is tagged private;
private
type Base is tagged
record
Number: Integer;
end record;
end Base_Class;
-- specification of Derived-Class
with Base_Class;
use Base_Class;
package Derived_Class is
type Derived is new Base with private;
procedure Derived_Proc(D: in out Derived; Num :Integer);
private
type Derived is new Base with
null record;
end Derived_Class;
-- body of Derived-Class
package body Derived_Class is
procedure Derived_Proc(D: in out Derived; Num :Integer) is
begin
D.Number := Num; -- here I get a compiler error. Why?
end Derived_Proc;
end Derived_Class;
Why can't I access Number which is a private-Element of the Base-Class?
Thanks for any help,
Rick
next reply other threads:[~2004-10-01 0:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-01 0:35 Rick Santa-Cruz [this message]
2004-10-01 0:54 ` access private element of base-class Jeffrey Carter
2004-10-01 7:45 ` Martin Krischik
2004-10-01 17:54 ` Jeffrey Carter
2004-10-01 17:58 ` Rick Santa-Cruz
2004-10-02 3:21 ` Brian May
2004-10-02 11:32 ` Ludovic Brenta
2004-10-02 13:56 ` Nick Roberts
2004-10-03 18:51 ` Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox