comp.lang.ada
 help / color / mirror / Atom feed
* Programming by interface in Ada
@ 2008-08-13 11:14 Sébastien Morand
  2008-08-13 15:31 ` Adam Beneschan
  0 siblings, 1 reply; 5+ messages in thread
From: Sébastien Morand @ 2008-08-13 11:14 UTC (permalink / raw)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I'm trying to do the following thing:

- --- pkginterface.ads -------------------------------
with ObjInterface; use ObjInterface;

package PkgInterface is

   --  Mon interface class
   type MonInterface is interface;
   type MonInterfacePtr is access all MonInterface;

   procedure SetObjet(r: in out MonInterface; c: in MonCount; o: in
MonObjetPtr) is abstract;


end PkgInterface;



- --- objinterface.ads -------------------------------
package ObjInterface is

   --  Mon interface class
   type MonObjet is interface;
   type MonObjetPtr is access all MonObjet;

end ObjInterface;


- --- pkgimpl.ads -------------------------------
with PkgInterface; use PkgInterface;
with ObjInterface; use ObjInterface;

package PkgImpl is

   type MonImpl is new MonInterface with private;
   type MonImplPtr is access all MonImpl;

   overriding
   procedure SetObjet(r: in out MonImpl; c: in MonCount; o: in MonObjetPtr);

private

   type MonImpl is new MonInterface with record
      a: MonObjetPtr;
   end record;


end PkgImpl;


- --- pkgimpl.adb -------------------------------
package body PkgImpl is

   procedure SetObjet(r: in out MonImpl; c: in MonCount; o: in
MonObjetPtr) is
   begin
      r.a := o;
   end SetObjet;


end PkgImpl;
- ----------------------------------

When I'm trying to compile pkgimpl.adb I get the following error:
pkgimpl:5:04: (Ada 2005) : abstract interface primitives must be defined
in package specs.

The interface primitive it's yelling about should be SetObjet which is
correctly defined in the spec. So waht's the matter? It looks like the
MonObjetPtr (access all ObjInterface) is the real problem.

How can I achieve this?

Thanks by advance,

Sebastien
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)

iD8DBQFIosID+zV9xm4PlDQRAnLLAJ9pHuAdVnQNrITgRZ1/RmCdGGLviwCbBggP
Fy0SSIMKb5/AM03KDKaq+WA=
=35KI
-----END PGP SIGNATURE-----



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

end of thread, other threads:[~2008-08-13 17:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-13 11:14 Programming by interface in Ada Sébastien Morand
2008-08-13 15:31 ` Adam Beneschan
2008-08-13 16:08   ` Marcus Lauster
2008-08-13 17:00   ` Robert A Duff
2008-08-13 17:42   ` Ludovic Brenta

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