What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
class A
{
public:
T func(T a, T b){
return a/b;
}
};
int main(int argc, char const *argv[])
{
A <char>a1;
cout<<a1.func(65,1)<<endl;
cout<<a1.func(65.28,1.1)<<endl;
return 0;
}
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
class A
{
public:
T func(T a, T b){
return a/b;
}
};
int main(int argc, char const *argv[])
{
A <char>a1;
cout<<a1.func(65,1)<<endl;
cout<<a1.func(65.28,1.1)<<endl;
return 0;
}A. A
A
B. 65
65
C. A
65
D. 65
A
Answer: Option A

Join The Discussion