-
What is the output of this program?
#include <iostream>
using namespace std;
template<typename type>
class Test
{
public:
virtual type Function(type num1)
{
return num1 * 2;
}
};
int main()
{
Test<int> num1;
cout << num1.Function(150) << endl;
return 0;
}
-
- 2
- 150
- Compilation Error
- 300
- Runtime Error
Correct Option: D
In this program, We are using class to pass the value and then we are manipulating it.