• Courses
  • Code Compiler
  • Discuss
  • Pricing
  • Teams
Menu

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+
c++operator-overloading
0 Votes
8 Answers
5th Sep 2016, 3:38 AM
Pranav Dixit
Hot today
Fix code
0 Votes
Fast coding (mobile)
1 Votes
..
1 Votes
Software to write and run codes
1 Votes
How can I turn my .py files to .exe files?
1 Votes
Add lua
0 Votes
Beginner_to_SoloLearn
1 Votes
How to learn C++ and how long does it take
1 Votes
Summary please??
0 Votes
DSA doubt
1 Votes