What will be the output if the following C++ program? #include<iostream.h>…

DSSSB 2018

What will be the output if the following C++ program?

#include<iostream.h>
using namespace std;
class example
{
    public:
    int a;
    example *operator->()
    {return this;}
};
int main( )
{
example ob;
ob->a=10;
cout<<ob.a<<" " <<ob->a;
return 0;
}
  1. A.

    10 10

  2. B.

    11 11

  3. C.

    Run time error

  4. D.

    Garbage value

Attempted by 380 students.

Sign up free to check your answer

Sign up free

Explore the full course: Bpsc

Loading lesson…