I was in the process of trying out inheritance in c++ and tried to make a simple class:
class Class
:public int
{
};
But upon trying to compile I get the (visual studio 2013) error C3770 "'int' is not a valid base class. This error also occurs with other primitive types like bools chars and longs.
However using a user defined class wrapping class works fine:
template<typename T>
class Wrapper
{
T Object;
public:
operator T&(){return Object;}
};
class Class
:public Wrapper<int>
{
};
My question is, is using primitive types directly as a base class illegal c++ or is it visual studio being difficult, or am I just plain doing inheritance wrong; I can't seem to find an answer anywhere.