-
What is the output of this program?
#include
using namespace std;
class Newclass
{
public:
int k;
Newclass *operator->()
{return this;}
};
int main()
{
Newclass object;
object->k = 15;
cout << object.k << " " << object->k;
return 0;
}
-
- 15
- 15 15
- Compilation Error
- Runtime Error
- None of these
Correct Option: B
In this program, -> operator is used to describe the member of the class and so we are getting this output.