Derivation and Templates

Q.

What is the output of this program?

1.
    #include 
2.
    using namespace std;
3.
    template 
4.
    class Test
5.
    {
6.
        public:
7.
        Test();
8.
        ~Test();
9.
        type Data(type);
10.
    };
11.
    template 
12.
    type Test::Data(type Var0)
13.
    {
14.
        return Var0;
15.
    }
16.
    template 
17.
    Test::Test()
18.
    {
19.
    }
20.
    template 
21.
    Test::~Test()
22.
    {
23.
    }
24.
    int main(void)
25.
    {
26.
        Test Var3;
27.
        cout << Var3.Data('K') << endl;
28.
        return 0;
29.
    }
A. k
B. l
C. error
D. runtime error

Answer : Option A

Explanation :

In this program, We are passing the values and printing it by using template inheritance.
Output:
$ g++ dert3.cpp
$ a.out
k