#include <iostream>
#include <string>
using namespace std;
class CAnyType //: public CObject
{
public:
CAnyType(){};
//DECLARE_SERIAL(CAnyType)
~CAnyType(){};
protected:
string DataType;
// union还可以用来判断大端还是小端
union{
int myint;
double mydouble;
float myfloat;
wchar_t mychar;} value;
public:
CAnyType operator=(const int &in){value.myint=in;DataType="int";return *this;}
CAnyType operator=(const wchar_t &in){value.mychar=in;DataType="char";return *this;}
CAnyType operator=(const float &in){value.myfloat=in,DataType="float";return *this;}
CAnyType operator=(const double &in){value.mydouble=in;DataType="double";return *this;}
friend std::ostream & operator<<(std::ostream &os, const CAnyType& ca){
os << ca.value.mydouble << std::endl;
return os;
};
};
int main()
{
using namespace std;
CAnyType test = CAnyType();
test = 55;
cout << test;
return 0;
}