Re: Nested sibling classes

2023-01-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/12/23 12:05 PM, seany wrote: How can I make it, that classes b and c can access each other, and create instances of each other freely? Thank you. So to just point out something that wasn't discussed by Salih: When you declare a field of a class with an initializer, *that initializer i

Re: Nested sibling classes

2023-01-12 Thread Salih Dincer via Digitalmars-d-learn
On Thursday, 12 January 2023 at 17:46:45 UTC, seany wrote: Please, can you explain what role "static" plays here? Thank you again Of course, there are actually 2 paragraphs of information and examples [here]( https://dlang.org/spec/class.html#nested-context): Non-static nested classes work

Re: Nested sibling classes

2023-01-12 Thread seany via Digitalmars-d-learn
On Thursday, 12 January 2023 at 17:41:39 UTC, Salih Dincer wrote: On Thursday, 12 January 2023 at 17:05:04 UTC, seany wrote: How can I make it, that classes b and c can access each other, and create instances of each other freely? Thank you. Ignoring the typos you could try auto and static:

Re: Nested sibling classes

2023-01-12 Thread Salih Dincer via Digitalmars-d-learn
On Thursday, 12 January 2023 at 17:05:04 UTC, seany wrote: How can I make it, that classes b and c can access each other, and create instances of each other freely? Thank you. Ignoring the typos you could try auto and static: ```d class a { //outer static class b { // inner 1 c C;

Nested sibling classes

2023-01-12 Thread seany via Digitalmars-d-learn
Please Consider the code: import std.stdio; class a { public: this(){} ~this(){} class b { public: this.outer.c C = new this.outer.c(); this() { writel