Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #ifndef UN1_A_H
- #define UN1_A_H
- #include "B.h"
- class A {
- public:
- std::vector<B&> get();
- };
- #endif //UN1_A_H
- #include "A.h"
- #include "B.h"
- std::vector<B &> A::get() {
- std::vector<B&> bs;
- bs.push_back(*(new B()));
- bs.push_back(*(new B()));
- return bs;
- }
- #include "A.h"
- #include "B.h"
- int main() {
- A& a = *(new A());
- B& b = a.get()[0];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement