Vidyalelo
C++ Programming · Q110

C++ miscellaneous

Programming · C++ Programming · question 110

Q110

What will be the output of the following C++ code? #include using namespace std; class X public: int a; void f(int b) cout<< b << endl; ; int main() int X :: *ptiptr = &X :: a; void (X :: * ptfptr) (int) = &X :: f; X xobject; xobject.*ptiptr = 10; cout << xobject.*ptiptr << endl; (xobject.*ptfptr) (20);

A.
10
20
Answer
B.
20
10
C.
20
D.
10

Answer: Option A

Solution

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