|
by Eric Lippert via Fabulous Adventures In Coding on 1/28/2010 3:10:00 PM
C# lets you call another constructor from a given constructor, but only before the body of the calling constructor runs:
public C(int x) : this(x, null){ // …}public C(int x, string y){ // …}
Why can you call another constructor at the beginning of a constructor block, but not at the end of the block, or in the middle of the block?
Well, let's break it down into two cases. (1) You're calling a "base" constructor, and (2) you're calling a "this" constructor.
For the "base" scenar
... [ read more ]
|
|