#include using namespace std; class Dumb { private: int a; public: Dumb() { a =
ID: 3667352 • Letter: #
Question
#include using namespace std; class Dumb { private: int a; public: Dumb() { a = 10; couta = obj.a + 1; cout a = right.a; cout << "Operator =" << endl; return *this; } Dumb operator++() { cout << ++a << endl; return *this; } }; int main() { cout << "1: "; Dumb dumb; cout << endl << "2: "; Dumb * dumber = & dumb; cout << endl << "3: "; dumb = *dumber; cout << endl << "4: "; ++dumb; return 0; } what do you expect from the above program? and justify your answers
Explanation / Answer
1.Creating a class Dumb, having a constructor and it is overloading increment operator
Constructor initializing member 'a' value with 10
2. In main:
Creating a object called 'dumb' and a ponter dumber to dumb
3. applying increment operator on dump, so it will increase value of member 'a'
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.