What is the output of this code ?plz explain step by step 🪜 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

What is the output of this code ?plz explain step by step 🪜

class A { public: int x; A(int x) { this->x = x; } A(A &p) { p.x = 3;x = 6;} }; int main() { A p1(2); A p2(pl); cout << p2.x+pl.x;

4th Mar 2021, 7:09 AM
Deepak Kumar
4 Answers
+ 1
Deepak Kumar This is not a place to come hire people to do your programming. You can try various freelancer websites to hire someone to write your app for you. you must do your own attempt first, and then if needed you could search if there's still a topic about your problem (here, or on internet), and finally you could post here to request help on a specific question, with providing a link to your code playground and a useful description of the task you want to do and the problem you're facing... Martin tried to explain to you what this code does. it is not complete, please follow its advice and post the full version of the code in your playground. I also suggested you a good resource where you can insert your code and see what it does step by step
4th Mar 2021, 11:46 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Hi! Visualize code execution http://www.pythontutor.com/
4th Mar 2021, 7:46 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Check it again I corrected the mistakes.
4th Mar 2021, 9:48 AM
Deepak Kumar
0
https://www.sololearn.com/post/968752/?ref=app . . Click on above link and see the screenshot of this question.
4th Mar 2021, 11:29 AM
Deepak Kumar