newbie: Circular references across modules
Ellery Newcomer
ellery-newcomer at utulsa.edu
Thu Apr 29 19:23:16 PDT 2010
On 04/29/2010 09:04 PM, Larry Luther wrote:
> This code describes the concept:
>
> module a;
> import B;
>
> struct A { B *ptr; }
>
> ---------------------
>
> module b;
> import A;
>
> struct B { A *ptr; }
>
> -----------------------------
>
> Can this be done?
sure
> Do both classes have to be in the same module?
It's probably not a bad idea to put A and B in the same module, but you
shouldn't run into any trouble as you are, as long as you don't need any
static constructors or destructors in either a or b.
More information about the Digitalmars-d-learn
mailing list