?
What will be the output of the following C++ code?
What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
class A
{
T a;
public:
A(){}
~A(){}
};
int main(int argc, char const *argv[])
{
A <char>a1;
A <int>a2;
A <double>a3;
cout<<sizeof(a1)<<endl;
cout<<sizeof(a2)<<endl;
cout<<sizeof(a3)<<endl;
return 0;
}
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
class A
{
T a;
public:
A(){}
~A(){}
};
int main(int argc, char const *argv[])
{
A <char>a1;
A <int>a2;
A <double>a3;
cout<<sizeof(a1)<<endl;
cout<<sizeof(a2)<<endl;
cout<<sizeof(a3)<<endl;
return 0;
}
Join the Discussion
Login to post a comment or share your explanation.
Login