d/compclass/compclass.d
2013-02-15 19:28:28 -05:00

30 lines
520 B
D

import std.stdio;
class Foo
{
public:
int a;
int b;
override bool opEquals(Object o_other)
{
Foo other = cast(Foo) o_other;
return a == other.a && b == other.b;
}
};
void main(string[] args)
{
Foo f = new Foo();
f.a = 1;
f.b = 2;
Foo g = new Foo();
g.a = 1;
g.b = 2;
Foo h = new Foo();
h.a = 1;
h.b = 3;
writefln("f == g: %s", f == g);
writefln("f == h: %s", f == h);
writefln("g == h: %s", g == h);
}