Vidyalelo
C++ Programming · Q97

Introduction to C++

Programming · C++ Programming · question 97

Q97

What will be the output of the following C++ code? #include using namespace std; class Point int x, y; public: Point(int i = 0, int j =0) x = i; y = j; int getX() const return x; int getY() return y; ; int main() const Point t; cout << t.getX() << " "; cout << t.gety(); return 0;

A.
0 0
B.
Garbage values
C.
Compile error
Answer
D.
Segmentation fault

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board