You can think of a class as an interface declaration which happens to expose some implementation details to you.
A class declaration is simply a declaration, it doesn't allocate
storage, so members end up being implicitly extern (or static
inline for methods with bodies) except for instance fields, whose
storage is allocated with the new operator. As static inlining a
field has no sense, it becomes extern. You can declare extern
variables in C too (try it). Extern declarations are included
into each including module, but you can't do it with the
variable's storage itself, so you should *define* the variable in
a module where it will actually keep its value. If you define a
variable in the header, it will be included in each including
module and you'll get several instances of the variable and
symbol collision at link time.
- gdc and gcc object linking issues Andrej Mitrovic
- Re: gdc and gcc object linking issues Dmitry Olshansky
- Re: gdc and gcc object linking issues Dmitry Olshansky
- Re: gdc and gcc object linking issues Andrej Mitrovic
- Re: gdc and gcc object linking issues Kagamin
- Re: gdc and gcc object linking issues Andrej Mitrovic
- Re: gdc and gcc object linking issues Regan Heath
- Re: gdc and gcc object linking issu... Kagamin
- Re: gdc and gcc object linking ... Dmitry Olshansky
- Re: gdc and gcc object linking issues Kagamin
- Re: gdc and gcc object linking issu... Andrej Mitrovic
- Re: gdc and gcc object linking issu... Kagamin
- Re: gdc and gcc object linking ... Andrej Mitrovic
