Reference to implementation of interface.
Christian Aistleitner
xy7p3vxz at gmx.net
Fri Jan 19 13:24:48 PST 2007
Hello,
I am in need of a way to reference the class implementing an interface
from within the interface's definition.
Example:
interface A
{
static A constA;
}
Here the type "A" within "static A constA" is short for any class
implementing the interface "A". But I'd prefer to have some way to
reference the class, which is implementing this interface -- and not "any
class implementing A".
The above definition of the interface "A" allows to write
class B: A
{
static B constA;
}
which is just what I want. However, it also allows
class C: A
{
static B constA;
}
which I would like to forbid. The "B" within the "static B constA" is the
problem. I would like to force it to "C" (the class currently implementing
the interface "A") within the definition of the interface "A".
Can this be modelled with D?
Kind regards,
Christian Aistleitner
More information about the Digitalmars-d-learn
mailing list