Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- struct Pepe {
- int x;
- int y;
- int z;
- Pepe(int fn, int sn, int tn) { /* struct constructor */
- x = fn;
- y = sn;
- z = tn;
- }
- };
- typedef struct Pepe Pepe;
- struct Juan {
- Pepe& pp;
- int a;
- Juan (Pepe p, int fn): pp(p),a(fn){} /* struct constructor */
- };
- typedef struct Juan Juan;
- int main (void) {
- Pepe joe = Pepe(0,1,2);
- Juan johnny = Juan(joe,18);
- cout << "Pepe: " << sizeof(joe) << endl << "Juan: " << sizeof(johnny) << endl << "Int: " << sizeof(int) << endl;
- return EXIT_SUCCESS;
- }
Add Comment
Please, Sign In to add comment