This is easy to work around, but I just curious if I could be using a language feature or possibly the fact that the language disallows it means I'm making a logical error in class design.
I'm doing a self review of my code to help "harden" it for re-use and I just came accross:
public partial class TrackTyped : Component
{
IContainer components = null;
public TrackTyped()
: base()
{
InitializeComponent();
}
public TrackTyped(IContainer container)
: base()
{
container.Add(this);
InitializeComponent();
}
}
What I usually do when I see the same line of code in two constructors is make one call the other with "this()" but I can't seem to do it.
If I read the spec right (I just started trying to read the spec so I may not be right):
10.11 Instance Constructors
constructor-declarator:
identifier ( formal-parameter-listopt ) constructor-initializeropt
constructor-initializer:
: base ( argument-listopt )
: this ( argument-listopt )
It's saying I can only have one of those.
QUESTION: is 10.11 implying that there's no reason to need to call both or is it simply implying that the language only supports calling one?