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
Give example of a pure virtual function in c++?
Is c++ a float?
What is operator overloading in c++ example?
What is the use of object in c++?
Define a conversion constructor?
how to connect with oracle 9i with server in socket program in c/c++
What does namespace mean in c++?
Difference between inline functions and macros?
What is the difference between a definition and a declaration?
What is & in c++ function?
What are protected members in c++?
What are the operators in c++?
Write a recursive program to calculate factorial in c++.
What is a class template?
What is #include sstream?