#include <iostream>
using namespace std;
class thing1
{
public:
void thingTest()
{
cout << "I AM THING 1!\n";
}
};
class thing2: public thing1
{
public:
void thingTest()
{
cout << "I AM THING 2\n";
}
};
void DoStuff( thing1 temp )
{
temp.thingTest();
}
void main()
{
DoStuff( thing2() );
}
I expected it to output:
"I AM THING 2"
But instead I got:
"I AM THING 1!"
clearly, I'm doing something wrong...
But instead I got:
"I AM THING 1!"
clearly, I'm doing something wrong...
make the constructor for thing1 virtual...
ReplyDelete