From: "Sébastien Morand" <seb.morand@gmail.com>
Subject: Programming by interface in Ada
Date: Wed, 13 Aug 2008 11:14:12 +0000
Date: 2008-08-13T11:14:12+00:00 [thread overview]
Message-ID: <g7ufm7$p77$1@registered.motzarella.org> (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-----
next reply other threads:[~2008-08-13 11:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-13 11:14 Sébastien Morand [this message]
2008-08-13 15:31 ` Programming by interface in Ada Adam Beneschan
2008-08-13 16:08 ` Marcus Lauster
2008-08-13 17:00 ` Robert A Duff
2008-08-13 17:42 ` Ludovic Brenta
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox