adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    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

b.

20 10

c.

20

d.

10

Answer: (a).10 20

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?