• Cours
  • Compilateur de code
  • Discuter
  • Tarification
  • Équipes
Menu

Discussions Q&R

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 Vote
8 Réponses
5th Sep 2016, 3:38 AM
Pranav Dixit
Aujourd'hui en vedette
Activities on sololearn
3 Votes
What is problem in this code
1 Votes
playground input
1 Votes
Html issue
2 Votes
This Program Does Something Weird. Can You Explain Why?
2 Votes
How I can use div
1 Votes
Can you help me ?
1 Votes
TIPS From Veterans
1 Votes
Playground input
1 Votes
App development đŸ”„â˜ïž
1 Votes