>How do you get the above working? any hint, suggestion, or solution will be appreciated
Well a and b are pointers, so:
is adding two pointers, not the contents of the class. What you want is:
But this is only guaranteed to work when a and b are pointing to allocated memory. It may work by accident, but to be correct you'd need to allocate memory first for both pointers:
Code:
a = new MyClass;
b = new MyClass;
*a += *b;
And once you're done with a and b, you'd need to deallocate the memory:
Code:
delete a;
delete b;