New course! Every coder should learn Generative AI!
Try a free lessonQ&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
Click to Chat
0 Votes
I need help please!!!
2 Votes
What is the output
0 Votes
What is the meaning of this tag
1 Votes