L
Lee
A ctor-like method is permitted in java, for example
public class MyClass
{
public MyClass() {//ctor here}
public void MyClass() {
//not a ctor, but a regular method, but permitted. it can be
called
like MyClassInstance.MyClass();
}
};
I am curious how the two functions are distinguished? They have the
same signature, return type does not count. This syntax is not
permitted in C++. I don't see why this feature is even allowed in
java, a safer language. Any comment?
Thanks
Lee
public class MyClass
{
public MyClass() {//ctor here}
public void MyClass() {
//not a ctor, but a regular method, but permitted. it can be
called
like MyClassInstance.MyClass();
}
};
I am curious how the two functions are distinguished? They have the
same signature, return type does not count. This syntax is not
permitted in C++. I don't see why this feature is even allowed in
java, a safer language. Any comment?
Thanks
Lee