adplus-dvertising
frame-decoration

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

Answer: (a).converted

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?