0

Can we assign objects of two different classes. Like obj1=obj2.

17th Sep 2016, 8:38 AM
Geek
Geek - avatar
3 ответов
+ 4
I thought it wouldn't work without overloading the = operator, but I've checked and found out there is a generic = implemented. I've tested it, and it works. = is the assignment operator by the way. If what you want is to test for equality, then you do have to overload the == operator.
17th Sep 2016, 8:58 AM
Zen
Zen - avatar
+ 2
c++ compiler has a default = overload for classes that's why ...
17th Sep 2016, 1:14 PM
Amir Hossein Farzin
Amir Hossein Farzin - avatar
+ 1
yes we can assign like mr.zen said
23rd Sep 2016, 6:30 PM
dileep vadlamudi
dileep vadlamudi - avatar