have i finally got the hang of templates ,,,
so making a template class saves you from typing out more class's
just so it can be a diferent type...
Code:
#include <iostream>
using namespace std;
template <class T>
class Temp
{
public:
T Varible; //Varible could be any data type..
private:
protected:
};
int main()
{
Temp<int> TemP;
Temp<double> TemPP; //now the Temp data member Varible can be a double
TemP.Varible = 40;
cout<< TemP.Varible <<endl;
cout<< "int " << sizeof(TemP.Varible) << " " << &TemP.Varible <<endl;
cout<< "double " << sizeof(TemPP.Varible) << " " << &TemPP.Varible <<endl;
//sizeof(TemP.Varible) <<endl;
return 0;
}