Q&A Discussions
can anyone plz explain me this program step by step?#include <iostream>
using namespace std;
class MyClass {
public:
int var;
MyClass() { }
MyClass(int a)
: var(a) { }
MyClass operator+(MyClass &obj) {
MyClass res;
res.var= this->var+obj.var;
return res;
}
};
int main() {
MyClass obj1(12), obj2(55);
MyClass res = obj1+obj2;
cout << res.var;
}I am not getting the part inside operator+
0 Votes
8 AnswersOperator overloading
0 Votes
11 AnswersPointer manipulation
2 Votes
4 AnswersOperator Overloading<<
1 Vote
3 AnswersWhy it's not working?
1 Vote
1 AnswerThe Example In Lesson
1 Vote
2 AnswersПомогите! Не понимаю задачу.
-1 Vote
1 AnswerHot today
How to allow one instance of exe
1 Votes
purchase of a subscription
1 Votes
What has happened?
1 Votes
Theater management help me
2 Votes
What should I add/improve ?
1 Votes