Question OOP-CLS-0044
MediumWhat is the output of this code?
#include <iostream>
using namespace std;
class Point {
public:
int x, y;
Point(int a, int b) : x(a), y(b) {}
};
int main() {
Point p(2, 3);
Point q = p;
q.x = 9;
cout << p.x << " " << q.x;
}
- A.
9 2
- B.
9 9
- C.
Sign up free to see the answer and a step-by-step explanation.