What I'm trying to do here is pass the same copy of class ( class A) to another class ( class B), but class Bset to class A.
Using the statement newin class Bwill not work, because it will cause an infinite loop, as well as creating a new instance when I want to use variables from the 1st instance class A.
I know about object.equals(), but I can’t use it until I define the object class Ain class B. Just use object.equalsleads to a null reference.
public partial class class_A : Form
{
public class_B _class_B = new class_B;
public Int32 var;
private void setclassA()
{
_class_B._class_A.equals(this);
}
}
public class class_B
{
public class_A _class_A;
}
As I said, I want to avoid creating a new copy of class A, because I want the values in class A to be set.
I tried using the method for this, but still getting a null reference.