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

What is a namespace in c++?

707


What is the protected keyword used for?

725


How is modularity introduced in C++?

852


How can you quickly find the number of elements stored in a a) static array b) dynamic array ? Why is it difficult to store linked list in an array?how can you find the nodes with repetetive data in a linked list?

849


What is a .h file c++?

610






What are the extraction and insertion operators in c++? Explain with examples.

771


On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?

769


What are the advantages of using friend classes?

723


What is a c++ map?

768


Describe linkages and types of linkages?

664


Why is c++ considered difficult?

737


What is object in c++ wikipedia?

645


Please explain the reference variable in c++?

703


Why do we use iterators?

720


Define namespace in c++?

726