Vidyalelo
C++ Programming · Q705

C++ miscellaneous

Programming · C++ Programming · question 705

Q705

What will be the output of the following C++ code? #include using namespace std; class Car public: int speed; ; int main() int Car :: *pSpeed = &Car :: speed; Car c1; c1.speed = 1; cout << c1.speed << endl; c1.*pSpeed = 2; cout << c1.speed << endl; return 0;

A.
1
B.
2
C.
Both 1 & 2
Answer
D.
4

Answer: Option C

Solution

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