crptcblade
May 29th, 2003, 04:25 PM
I remember in Java, being able to do something like this...
public class SomeClass
{
public SomeClass() { this(0); }
public SomeClass(int x) { this(x,""); }
public SomeClass(int x, string s) { /* ... */ }
}
And that would work its way down the chain of constructors so that you didn't need a lot of repeat initializing code. That may not be the completely correct syntax, but I hope you get the idea.
Anyway, this doesn't seem to work in C#. Is there any way to do something like the above in C#?
:)
public class SomeClass
{
public SomeClass() { this(0); }
public SomeClass(int x) { this(x,""); }
public SomeClass(int x, string s) { /* ... */ }
}
And that would work its way down the chain of constructors so that you didn't need a lot of repeat initializing code. That may not be the completely correct syntax, but I hope you get the idea.
Anyway, this doesn't seem to work in C#. Is there any way to do something like the above in C#?
:)