Skip to main content
gamedev.net
๐Ÿ”’ Locked

Quick class scope question...

Started by Silex Jan 26, 2004 at 10:10 PM 0 replies 150+ views
Original Post
Silex
Silex
Consider:
class child2
{
	int shit;
public:
	int getshit() {return shit;};
};

class child1
{
public:
	void printshit() { cout << Timmy.getshit(); };
};

class parent
{
	child1 Bob;
	child2 Timmy;

public:
	void doshit() { Bob.printshit(); };
};
 
Is there a way to get this to work without passing a pointer to Bob?
Zahlman
Zahlman
Make Bob and Timmy static, and make child1 a subclass of parent.

But chances are you don''t want to do that.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.