If a class has 2 constructors:
public MyClass() { ... }
and
public MyClass(int i) { ... }
How can the parameterized constructor, MyClass(i), call the
parameterless constructor, MyClass()?
Patricia Shanahan - 28 Feb 2007 04:47 GMT
> If a class has 2 constructors:
>
[quoted text clipped - 6 lines]
> How can the parameterized constructor, MyClass(i), call the
> parameterless constructor, MyClass()?
It can do it at the start of its body, instead of a super call, using
"this":
public Myclass(int i){
this();
....
}
Patricia