root/trunk/src/tutorials/examples/dm_D_29598/struct2.d
| Revision 6, 298 bytes (checked in by jcc7, 3 years ago) |
|---|
| Line | |
|---|---|
| 1 | struct Foo |
| 2 | { |
| 3 | int x; |
| 4 | } |
| 5 | |
| 6 | void test(Foo foo) |
| 7 | { |
| 8 | size_t o; |
| 9 | |
| 10 | //o = Foo.x.offsetof; // error, .offsetof an int type |
| 11 | o = foo.x.offsetof; // yields 8 |
| 12 | |
| 13 | /* |
| 14 | |
| 15 | struct2.d(11): no property 'offsetof' for type 'int' |
| 16 | |
| 17 | */ |
| 18 | |
| 19 | } |
| 20 | |
| 21 | |
| 22 | void main() |
| 23 | { |
| 24 | Foo f; |
| 25 | test(f); |
| 26 | } |
Note: See TracBrowser for help on using the browser.
