Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Help with a C++ Problem

How would I go about returning the value of x, y , doStuff(), doStuff2(), in the extractThing function in the following code.

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)
{


    return 0;
}

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

Thanks

MODERATOR EDIT: Changed topic of Post to "General Discussion" as it does not pertain to any specific Treehouse content.