Re: Inheritance of constructors.

Tech-Archive recommends: Fix windows errors by optimizing your registry



class Test
{
static void Main()
{
string[] x = {"Jon", "Holly"};
Foo foo = new Foo(x);
foo.ShowNames();
x[0] = "Robin";
x[1] = "William";
foo.ShowNames();
}
}

And what now happens if you wanted to add yet another field? You'd have to write x = {"bla", "bla", "bla"} which results in a new reference by value that isn't passed to Foo. OK, you may go for some more advanced container of objects where you can add/delete all stuff by appropriate methods, though this suddenly becomes more and more elaborate while with means of memory-wise reference you could replace the whole array easily if needed.
.



Relevant Pages