This is a possible approach for fully or partially initializing an object that copies the values of elements from the original object.
In your case, you can call this as matching objects.
rectangle CreateFrom, , factory:
class rectangle
{
private int length;
private int breadth;
public static rectangle CreateFrom(rectangle x)
{
rectangle r = new rectangle();
r.length = x.length;
r.breadth = x.breadth;
return r;
}
}
... , , :
private void button8_Click(object sender, EventArgs e)
{
rectangle r1 = new rectangle(50, 70);
rectangle r2 = rectangle.CreateFrom(r1);
}