-
What is the output of this program?
#include <iostream>
using namespace std;
template <class T>
class N
{
public:
N(int p): q(p) {}
protected:
int q;
};
template <class T>
class M: public N<char>
{
public:
M(): N<char>::N(50)
{
cout << q * 3 << endl;
}
};
int main()
{
M<char> test;
return 0;
}
-
- 50
- 150
- Compilation Error
- Runtime Error
- None of these
Correct Option: B
In this program, We are passing the values and manipulating it by using the template inheritance.