I\'d love to be able to do this:
class myInt : public int
{
};
Why can\'t I?
Why would I want to? Stronger typing. For example, I
What others have said is true... int is a primitive in C++ (much like C#). However, you can achieve what you wanted by just building a class around int:
class MyInt
{
private:
int mInt;
public:
explicit MyInt(int in) { mInt = in; }
// Getters/setters etc
};
You can then inherit from that all you jolly want.