N
Nicolas
Hi,
How can one call a constructor in the same class as the constructor itself ?
Thanks.
How can one call a constructor in the same class as the constructor itself ?
Thanks.
How can one call a constructor in the same class as the constructor itself ?
Mattias said:class Foo
{
public Foo(string s) { ... }
public Foo(int i) : this(i.ToString()) {}
// like this -> ^^^^^^^^^^^^^^^^^^^^
}
class Foo
{
public Foo(string s) { ... }
public Foo(int i) : this(i.ToString()) {}
// like this -> ^^^^^^^^^^^^^^^^^^^^
}
Richard said:Are you trying to "re-initialize" your instance using a specific constructor?
That's it exactly. I know that simply calling an init() method from both
the constructor and the place where I want to re-init is an option, but
I am just curious to see whether it's possible to do it with a ctor.
--
Truth,
James Curran =======================================
[erstwhile VC++ MVP] <<<<<<<<<<<<<<<< ??? =======================================
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
Peter N Roth said:=======================================[erstwhile VC++ MVP] <<<<<<<<<<<<<<<< ??? =======================================
Hi James - why'd you "switch"?