SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <cstdlib> | |
| 2 | #include <iostream> | |
| 3 | ||
| 4 | using namespace std; | |
| 5 | ||
| 6 | - | struct Pepe {
|
| 6 | + | struct Pepe |
| 7 | {
| |
| 8 | int x; | |
| 9 | int y; | |
| 10 | - | Pepe(int fn, int sn, int tn) { /* struct constructor */
|
| 10 | + | |
| 11 | Pepe(int fn, int sn, int tn) /* struct constructor */ | |
| 12 | {
| |
| 13 | x = fn; | |
| 14 | y = sn; | |
| 15 | z = tn; | |
| 16 | - | typedef struct Pepe Pepe; |
| 16 | + | |
| 17 | }; | |
| 18 | - | struct Juan {
|
| 18 | + | |
| 19 | struct Juan | |
| 20 | {
| |
| 21 | Pepe& pp; | |
| 22 | int a; | |
| 23 | - | typedef struct Juan Juan; |
| 23 | + | |
| 24 | }; | |
| 25 | - | int main (void) {
|
| 25 | + | |
| 26 | int main (void) | |
| 27 | {
| |
| 28 | ||
| 29 | Pepe joe = Pepe(0,1,2); | |
| 30 | ||
| 31 | Juan johnny = Juan(joe,18); | |
| 32 | ||
| 33 | cout << "Pepe: " << sizeof(joe) << endl << "Juan: " << sizeof(johnny) << endl << "Int: " << sizeof(int) << endl; | |
| 34 | ||
| 35 | return EXIT_SUCCESS; | |
| 36 | } |