Question
1.
#include
2.
using namespace std;
3.
template class A
4.
{
5.
public:
6.
A();
7.
int value;
8.
};
9.
template class A
10.
{
11.
public: A();
12.
};
13.
template class A
14.
{
15.
public: A();
16.
};
17.
template A::A() : value(i)
18.
{
19.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
template class A
4.
{
5.
public:
6.
A();
7.
int value;
8.
};
9.
template class A
10.
{
11.
public: A();
12.
};
13.
template class A
14.
{
15.
public: A();
16.
};
17.
template A::A() : value(i)
18.
{
19.
cout
Answer: Option C
Was this answer helpful ?
In this program, We are defining three templates and specializing it and passing the values to
it and printing it.
Output:
$ g++ spec5.cpp
$ a.out
6default10
Was this answer helpful ?
More Questions on This Topic :
Question 6.
What is meant by template specialization?
....
Submit Solution