Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foo;
- class Bar{
- private:
- int x_;
- Foo foo_; // error: incomplete type
- public:
- void setx(int x) {x_ = x;};
- void increment(int);
- };
- class Foo{
- public:
- void run(int y,Bar& bar) {bar.setx(y);};
- };
- void Bar::increment(int i){foo_.run(i,*this);}
- class Bar;
- class Foo{
- public:
- void run(int y,Bar& bar);
- };
- class Bar { ... };
- void Foo::run(int y, Bar& bar) {
- bar.setx(y);
- }
- class Foo;
- class Bar{
- Foo foo_; // error: incomplete type
- };
- class Foo{
- // put details here
- };
- class Bar{
- Foo foo_; // OK
- };
- class Foo;
- class Bar{
- std::unique_ptr<Foo> foo_; // OK
- };
Add Comment
Please, Sign In to add comment