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
Which header file allows file i/o with streams a) fileio.h b) iostream.h c) fstream.h
What is the need of a destructor? Explain with the help of an example.
What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?
Are vectors faster than arrays?
What is size_type?
Is dev c++ free?
Why is main an int?
What are c++ stream classes?
Difference between pass by value and pass by reference?
Can I learn c++ without knowing c?
What is recursion?
What is the c++ code?
How static variables and local variablesare similar and dissimilar?
Difference between overloaded functions and overridden functions
I want to write a C++ language program that: 1. Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. The program should work for squares of all side sizes between 1 and 20.