comp.lang.ada
 help / color / mirror / Atom feed
* access private element of base-class
@ 2004-10-01  0:35 Rick Santa-Cruz
  2004-10-01  0:54 ` Jeffrey Carter
  0 siblings, 1 reply; 9+ messages in thread
From: Rick Santa-Cruz @ 2004-10-01  0:35 UTC (permalink / 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 





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-10-03 18:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-01  0:35 access private element of base-class Rick Santa-Cruz
2004-10-01  0:54 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox