Reputation: 16780
I have a header file in which I have defined a struct. I want an instance of this struct to be a member of a class that is defined in a different file. How do I do it?
Upvotes: 0
Views: 257
Reputation: 91270
#include
the header containing the struct in the header where you define the class.
Foo.h:
struct Foo {
};
Bar.h:
#include "Foo.h"
class Bar {
Foo f;
};
Upvotes: 9