LOL...when I read the title I couldnt think what you meant!
The answer is yes btw..but you will need moer overloaded operators to get it to work ok..you need an operator for the types you want to convert to...you can also overload operators like +,-,= etc...
Code:
#include<iostream>
class MyOwnInt
{
int Var;
public:
MyOwnInt():Var(0){};//dont forget to initalise
int operator=(int x){Var += x;return Var;};// for assignment
operator int(){return Var;};//for int conversion
};
int main()
{
MyOwnInt MyVar;
MyVar = 10;
int TempVar = MyVar;
std::cout << TempVar << std::endl;
return 0;
}
<edit> oh...and make MyVar private..</edit>