"DaTurk" <mm******@hotmail.comwrote in message
news:11*********************@p77g2000hsh.googlegro ups.com...
Hi,
I was wondering if there is a CLI equivalent to using the this keyword
to overload constructors. You know where you would do something like
Constructor chaining isn't permitted in C++, it would violate object
lifetime rules. In .NET, an object is alive before the first user code in
any constructor starts running. In C++, the object is constructed
piecemeal, and each subobject becomes alive when its constructor starts.
Being able to call a different constructor, would imply the object is born
twice, which isn't allowed. Why this restriction applies to ref classes,
which follow .NET lifetime rules, I don't know. But, you can certainly have
a reusable helper function called from more than one constructor (you can't
reuse base and member initialization expressions though).
>
MyClass() : this("something")
{
}
MyClass(String name)
{
}
I can't seem to figure it out.
Thanks in advance