codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
import std.stdio; class Bar { package long x; this (long x) { this.x = x; } } class Foo { package int t; this (int t) { this.t = t; } public int opEquals (Foo foo) { writefln("opEquals(Foo): called"); return this.t == foo.t; } public int opEquals (Bar bar) { writefln("opEquals(Bar): called"); return this.t == bar.x; } } void main (string[] args) { Foo foo = new Foo(1); writefln("%s", foo == new Foo(1) ? "true" : "false"); writefln("%s", foo == new Bar(1) ? "true" : "false"); }
Private
[
?
]
Run code
Submit