#include
using namespace std;
class test
{
private:
int value;
public:
test():value(0) { }
test(int v):value(v) { }
explicit test(const char *ch):value(*ch) { }
operator int() { return value; }
};
int main()
{
test t = 3;
// test t2 = static_cast
test t2 = static_cast
int val1 = t;
int val2 = t2;
cout << val1 << endl; cout << val2 << endl; } [/code]
Leave a Reply