Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // file: X.h
- class X {
- public:
- X() {};
- ~X() {};
- void fooX() { // do stuff };
- void barX() { // do more stuff };
- }
- // file: X.cpp
- #include "X.h";
- // file: Y.h
- #include "X.h"
- class Y {
- public:
- Y() {x = new X()};
- ~Y() {};
- fooY() { // do stuff };
- barY() { // do more stuff };
- private:
- X x; // object of class X
- }
- // file: Y.cpp
- #include "Y.h"
- // file: Z.h
- #include "Y.h"
- class Z {
- public:
- Z(uint8_t, std::string, std::vector<uint8_t>);
- ~Z() {};
- fooZ() { // do stuff };
- barZ() { // do more stuff };
- private:
- Y y; // object of class Y
- }
- // file: Z.cpp
- #include "Z.h"
- Z::Z(uint8_t a, std::string b, std::vector<uint8_t> c)
- {
- /// do stuff and create an object of Y
- Y y = new Y();
- }
- // file api.h
- #include "Z.h"
- void accessZ(uint8_t, std::string, std::vector<uint8_t>);
- // file api.cpp
- #include "api.h"
- void accessZ(uint8_t a_uint,
- std::string b_string,
- std::vector<uint8_t> c_vector)
- {
- // create object of Z
- Z z = new Z(a_uint, b_string, c_vector);
- z->fooZ();
- delete z;
- z = NULL;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement