Home » C++ Programming » Objects and Classes

What will be the output of the following program? #include class Tab { public: int x; }; int main() { Tab *p = new Tab(); (*p).x = 10; cout<< (*p).x << " " << p->x << " " ; p->x = 20; cout<< (*p).x << " " << p->x ; return 0; }

Correct Answer: 10 10 20 20

← Previous Question Next Question→

More Questions from Objects and Classes

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion