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