Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
class myclass
4.
{
5.
public:
6.
int i;
7.
myclass *operator->()
8.
{return this;}
9.
};
10.
int main()
11.
{
12.
myclass ob;
13.
ob->i = 10;
14.
cout
Options:
A .  10 10
B .  11 11
C .  error
D .  runtime error
Answer: Option A

In this program, -> operator is used to describe the member of the class and so we are getting this output.
Output:
$ g++ char4.cpp
$ a.out
10 10



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers