ExamVeda
Login
Home
C plus plus miscellaneous
?

What will be the output of the following C++ code?
#include <iostream>
using namespace std; 
template<typename T>class clsTemplate
{
    public:
    T value;
    clsTemplate(T i)
    {
        this->value = i;
    }
void test()
{
    cout << value << endl;
}
};
class clsChild : public clsTemplate<char>
{
    public:
    clsChild(): clsTemplate<char>( 0 )
    {
    }
    clsChild(char c): clsTemplate<char>( c )
    {    
    }
void test2()
{
    test();
}
};
int main()
{
    clsTemplate <int> a( 42 );
    clsChild b( 'A' );
    a.test();
    b.test();
    return 0;
}

Answer & Solution
Correct Answer: Option C
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.