template<class T, class X> class Obj {
T my_t;
X my_x;
public:
Obj(T t, X x) : my_t(t), my_x(x) { }
};
Referring to the sample code above, which one of the
following is a valid conversion operator for the type T?
a) T operator T () { return my_t; }
b) T operator(T) const { return my_t; }
c) operator(T) { return my_t; }
d) T operator T (const Obj &obj) { return obj.my_t; }
e) operator T () const { return my_t; }

Answer Posted / guest

option 'e' is the correct one

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Give example of a pure virtual function in c++?

583


Is c++ a float?

601


What is operator overloading in c++ example?

648


What is the use of object in c++?

564


Define a conversion constructor?

608






how to connect with oracle 9i with server in socket program in c/c++

1847


What does namespace mean in c++?

550


Difference between inline functions and macros?

596


What is the difference between a definition and a declaration?

578


What is & in c++ function?

588


What are protected members in c++?

617


What are the operators in c++?

592


Write a recursive program to calculate factorial in c++.

605


What is a class template?

583


What is #include sstream?

622