Skip to main content
GameDev.net gamedev.net
🔒 Locked

Struct in a Class

Started by mrtuti_17 May 2, 2003 at 10:35 AM 2 replies 950+ views
Original Post
mrtuti_17
mrtuti_17
How would I implement a structure as a private member inside of a Class? Thanks, Justin
noVum
noVum
??


class A
{
public:
...
private:
struct B
{
...
};
};
Ishan
Ishan

class foo{
public:
char c;
private:
struct bar{
int a;
int b;
};
}


Within foo you can create instances of bar and use them normally, you just can''t use them outside of foo. Had bar been declared as public, you could declare stuff like foo::bar b;
mrtuti_17
mrtuti_17
Thanks everyone, that really helped.

-Justin

Topic Locked

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

Sign in to reply to this topic.