Re: 2 initializers in 1 constructor
- From: "Ben Voigt" <rbv@xxxxxxxxxxxxx>
- Date: Fri, 9 Mar 2007 15:43:47 -0600
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.com> wrote in
message news:Of9EMbmYHHA.984@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
<narayanareddy.tera@xxxxxxxxx> wrote in message
news:1173432680.554454.51100@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi GeezerButler,
the dot not compiler does allow us to invoke 2 constuctors(whether the
two are of it's own or it's parent).you can invoke only one either
of it's own or it's parent.
No really, you have to invoke one of the constructor defined by the
current class, is this constructor the one that call the parent.
Here the reason is, if it allows then 2 objects of that class will be
instantiated (one by each constructor invoke) .one of the two objects
would become unreached oblect.
I do not understand the above sentence, do you care elaborate it further?
When you call a sibling constructor, it calls a base constructor. If you
called the base constructor again yourself, you'd now have two live
instances of the base class (possibly the second overwrote the memory of the
first). In any case, the derived class should only have one base
sub-object, the other would become unreachable.
.
- Follow-Ups:
- Re: 2 initializers in 1 constructor
- From: Jon Skeet [C# MVP]
- Re: 2 initializers in 1 constructor
- References:
- 2 initializers in 1 constructor
- From: GeezerButler
- Re: 2 initializers in 1 constructor
- From: Jon Skeet [C# MVP]
- Re: 2 initializers in 1 constructor
- From: narayanareddy.tera@xxxxxxxxx
- Re: 2 initializers in 1 constructor
- From: Ignacio Machin \( .NET/ C# MVP \)
- 2 initializers in 1 constructor
- Prev by Date: Re: .NET 2.0 memory usage: 32bit vs 64bit.
- Next by Date: Re: why is sealed and static not possible at the same time?
- Previous by thread: Re: 2 initializers in 1 constructor
- Next by thread: Re: 2 initializers in 1 constructor
- Index(es):
Relevant Pages
|