I apologize for asking something that is probably too basic for C# folks. I'm mostly doing my coding in C++.
So if I want to write an assignment constructor for my class, how do I do that? I have this so far, but it doesn't seem to compile:
public class MyClass
{
public string s1;
public string s2;
public int v1;
public MyClass()
{
s1 = "";
s2 = "";
v1 = 0;
}
public MyClass(MyClass s)
{
this = s; //Error on this line
}
}
MyClass a = new MyClass();
MyClass b = new MyClass(a);