Suppose I have a class MyClass
. Then I have an instance of this class like:
MyClass myobject = ...
Then I want to do 2 things:
- Copy the instance to another object.
- Compare two instances to check if they are the same (equal).
What's the simplest solution for this? I have searched the internet and found many solutions, but none of them are as simple as I expected.