January 07, 2011 Variants for interfaces | ||||
|---|---|---|---|---|
| ||||
Hi,
Is it possible to point a variable to an interface. The below code does not compile.
module testD;
import std.stream;
import std.stdio;
import std.variant;
interface A {
void func1();
}
class AC: A {
void func1() {
writeln("func1");
}
}
int main() {
A a = new AC();
a.func1();
Variant b = Variant(a);
return 0;
}
It says that opEquals is not defined for the interface.
Thanks & Regards
Mandeep
| ||||
January 07, 2011 Re: Variants for interfaces | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Mandeep Singh Brar | Mandeep Singh Brar Wrote: > Hi, > > Is it possible to point a variable to an interface. The below code does not compile. > > module testD; > import std.stream; > import std.stdio; > import std.variant; > > interface A { > void func1(); > } > class AC: A { > void func1() { > writeln("func1"); > } > } > int main() { > A a = new AC(); > a.func1(); > Variant b = Variant(a); > return 0; > } > > It says that opEquals is not defined for the interface. > > Thanks & Regards > Mandeep I suggest submitting it as a bug: http://d.puremagic.com/issues/ | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply