Interviewer And Interviewee Guide

C++ Operator Overloading Interview Question:

What is the output of this program?

#include <iostream>
#include <string>
using namespace std;
class test
{
public:
operator string ()
{
return "Converted";
}
};
int main()
{
test t;
string s = t;
cout << s << endl;
return 0;
}
a) converted
b) error
c) run time error
d) None of the mentioned

Submitted by: Administrator
a) converted
Submitted by:

Read Online C++ Operator Overloading Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.