comp.lang.ada
 help / color / mirror / Atom feed
* classes and pointers
  2000-12-17  3:37 classes and pointers Ory Segal
@ 2000-12-16 18:23 ` tmoran
  2000-12-16 18:57   ` Ehud Lamm
  0 siblings, 1 reply; 3+ messages in thread
From: tmoran @ 2000-12-16 18:23 UTC (permalink / raw)


>a) Pointer.all.do1
  Try a procedure call do1(Pointer.all);  just as you would do1(x);



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

* Re: classes and pointers
  2000-12-16 18:23 ` tmoran
@ 2000-12-16 18:57   ` Ehud Lamm
  0 siblings, 0 replies; 3+ messages in thread
From: Ehud Lamm @ 2000-12-16 18:57 UTC (permalink / raw)


<tmoran@acm.org> wrote in message
news:YqO_5.35915$M5.1372656@news1.frmt1.sfba.home.com...
> >a) Pointer.all.do1
>   Try a procedure call do1(Pointer.all);  just as you would do1(x);

Which should be obvious, since somewhere you must also allocate the memory
(use "new").


--
Ehud Lamm   mslamm@mscc.huji.ac.il









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

* classes and pointers
@ 2000-12-17  3:37 Ory Segal
  2000-12-16 18:23 ` tmoran
  0 siblings, 1 reply; 3+ messages in thread
From: Ory Segal @ 2000-12-17  3:37 UTC (permalink / raw)


Hi , can somebody please check what's wrong with my hierarchy/classes :

base_package:

 type base_type is abstract tagged record
         a : sometype;
         b : sometype;
      end record;

procedure do1(A : base_type) is abstract;
procedure do2(A : base_type) is abstract;
end base_package
****************************************
Then I have the typePackage :

type type1 is new base_package.base_type with
    record
           c : sometype;
           d: sometype;
    end record;

type type2 is new base_package.base_type with
    record
            e: sometype;
            f : sometype;
    end record;

Now , here comes implementations of do1 , do2 for both types type1,type2;
now the main progrem has "with" clause for both typePackage , base_package;
and I can create instances and fill them with values , BUT , if I want to
create a pointer (in main)
like this :
type TypePtr is access base_type'class
Pointer : TypePtr;

and then I try to call a function for that pointer , I can't seem to get the
procedures to be recognized.
how do I call the procedure ? do I use :
a) Pointer.all.do1
b) Pointer.do1

or what ? nothing works....
thank you.








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

end of thread, other threads:[~2000-12-17  3:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-17  3:37 classes and pointers Ory Segal
2000-12-16 18:23 ` tmoran
2000-12-16 18:57   ` Ehud Lamm

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