What I should code

Try to get the program to output the following things (only one at a time, since there is only one return value):
thing.x
thing.y
thing.doStuff()
thing.doStuff2()

------------

#include <cstdio>

class Thing
{
private:
int x;
int y;
virtual int doStuff()
{
return x+y;
}
virtual int doStuff2()
{
return x*y;
}
public:
Thing(){
x = 2;
y = 10;
}
};

int extractThing(void* thing)
{
//insert code here
//return the value to be printed
}

int main()
{
Thing thing;
printf("%d\n", extractThing(&thing));
return 0;
}

Topic archived. No new replies allowed.