-
What is the output of this program?
#include <iostream>
#include <string>
using namespace std;
class Example
{
public:
operator string ()
{
return "Converted...";
}
};
int main()
{
Example examp;
string str = examp;
cout << str << endl;
return 0;
}
-
- Compilation Error
- Runtime Error
- Converted...
- Garbage value
- None of these
Correct Option: C
In this program, We casted the string to the object of the class.