How does polymorph ambiguity distinction work?
Posted
by Pentius
on Stack Overflow
See other posts from Stack Overflow
or by Pentius
Published on 2010-04-17T18:30:27Z
Indexed on
2010/04/17
18:33 UTC
Read the original article
Hit count: 192
Given I have a class with two constructors:
public class TestClass {
ObjectOne o1;
ObjectTwo o2;
public TestClass(ObjectOne o1) {
// ..
}
public TestClass(ObjectTwo o2) {
// ..
}
}
What happens, if I call:
new TestClass(null);
How to determine the correct method to call? And who determines that? Are there differences between Java and other OOP languages?
© Stack Overflow or respective owner