I have implemented a class as below:
public class Person
{
public int d, e, f;
public Person()
{
}
public Person(int a)
{
}
public Person(int a, int b)
{
new Person(40, 6, 8);
}
public Person(int a, int b, int c)
{
d = a; e = b; f = c;
}
}
public class Program
{
static void Main(string[] args)
{
Person P = new Person(100, 200);
Console.WriteLine("{0},{1},{2}", P.d, P.e, P.f);// it prints 0,0,0
}
}
Now if I create the instance of Person class with two arguments I am unable to set the values of d,e,f which is because in the third constructor a new object of Person is declared all together.
So the previous object does not have any idea about this new one.
Is there any way I can get hold of this new object and assign values to d,e,f from there?