Re: Inheritance of constructors.
- From: "Jon Skeet [C# MVP]" <skeet@xxxxxxxxx>
- Date: Mon, 30 Jun 2008 05:56:19 -0700 (PDT)
On Jun 30, 1:43 pm, A n g l e r <p|k|o|n|i|u|...@xxxxxxxxxxxxxxxxxxx>
wrote:
Basically you can't write any actual code in the constructor before
the base constructor call. You *can* make a static method call, so you
can do:
Brilliant, I thought so. Blooming drawbacks of the garbage collector and
the whole automated memory management by ms, right? :/
Well, it's more that doing things within an object before it's been
initialized in the parent is somewhat questionable.
<snip>
That won't help you for a ref parameter, however. Are you sure you
need a ref parameter in the constructor call? That's pretty unusual.
No, I guess I don't cos I pass just an array of objects which anyway
means (I guess so) it's handled in a similar way to reference. Isn't it?
DataGridView[] arr = new DataGridView[] { grid1, grid2, grid3 };
There's a big difference between "pass by reference" and "pass
reference by value". It confuses quite a lot of people, and it's well
worth being aware of the difference. It's mostly down to confusingly
named terminology, IMO.
See http://pobox.com/~skeet/csharp/parameters.html
Jon
.
- Follow-Ups:
- Re: Inheritance of constructors.
- From: A n g l e r
- Re: Inheritance of constructors.
- References:
- Inheritance of constructors.
- From: A n g l e r
- Re: Inheritance of constructors.
- From: Jon Skeet [C# MVP]
- Re: Inheritance of constructors.
- From: A n g l e r
- Inheritance of constructors.
- Prev by Date: Re: Inheritance of constructors.
- Next by Date: Re: List in this CollectionBase
- Previous by thread: Re: Inheritance of constructors.
- Next by thread: Re: Inheritance of constructors.
- Index(es):
Relevant Pages
|