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; }



template<class T, class X> class Obj { T my_t; X my_x; public: Obj(T t, X ..

Answer / guest

option 'e' is the correct one

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

Explain deep copy?

0 Answers  


What is the basic of c++?

0 Answers  


Define a program that reads two matrices of size 3x3 with real values from the user then prints their sum, difference and multiplication.

0 Answers   TCS,


Write a function that swaps the values of two integers, using int* as the argument type?

0 Answers  


Can union be self referenced?

0 Answers  






What is the most powerful coding language?

0 Answers  


Can we use clrscr in c++?

0 Answers  


We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p?

0 Answers  


Distinguish between new and malloc and delete and free().

0 Answers  


Describe run-time type identification?

1 Answers  


What is function overloading in C++?

1 Answers  


What is the benefit of encapsulation?

0 Answers  


Categories