Original Post
Hey I thought I knew C++ pretty well, but this code seems to be crashing on the 3rd line of the main function and I can't see why. Anyone got any ideas? Thanks
// Me class
class Me
{
protected:
int m_I;
public:
Me( int i ) { m_I = i; }
virtual ~Me() {}
virtual void Print() = 0;
};
// Inherited you class
class You : public Me
{
int j;
public:
You() : Me( 0 )
{
j = m_I;
}
virtual ~You() {}
virtual void Print()
{
printf( "%i\n", j );
}
};
int _tmain(int argc, _TCHAR* argv[])
{
Me* you = new You[ 3 ];
you[0].Print();
you[1].Print();
you[2].Print();
return 0;
}