I have created a simple class called Foo, which contains a data member, Bar, which is a struct.
class Foo
{
public :
struct Bar {
int a;
};
};
I'd like to be able to access members in the struct either from functions I define in the class, or from the driver file, but I'm not sure how. Note: I've declared Bar as a public member because I am trying to access the members directly without using a get function. There is method in my madness, but I'll get to that later, so please accept that I want the struct to be public for now.
This is a very stripped down version of a larger program, so please forgive the simplicity.
Bar
is not a data member, it is a class definition. You need something likeBar bar;
to havebar
as a member ofFoo
– kmdreko