Re: best approach to code hierarchical classes ?

2021-06-09 Thread someone via Digitalmars-d-learn
On Tuesday, 8 June 2021 at 02:37:44 UTC, someone wrote: On Tuesday, 8 June 2021 at 02:05:27 UTC, Paul Backus wrote: Your module and class are both named `classComputers`, with an `s` at the end. You should change one of the to have a different name so that there's no ambiguity. Although I

Re: best approach to code hierarchical classes ?

2021-06-07 Thread someone via Digitalmars-d-learn
On Tuesday, 8 June 2021 at 02:05:27 UTC, Paul Backus wrote: Your module and class are both named `classComputers`, with an `s` at the end. You should change one of the to have a different name so that there's no ambiguity. dmd output: ./dm.d(49): Error: undefined identifier `classComputer`

Re: best approach to code hierarchical classes ?

2021-06-07 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 8 June 2021 at 01:17:05 UTC, someone wrote: On Tuesday, 8 June 2021 at 00:54:41 UTC, someone wrote: Are there alternatives to nested classes for such scenarios ? Self-reply: I created two files for classComputers and classComputer and I replaced the nested-classComputer code

Re: best approach to code hierarchical classes ?

2021-06-07 Thread someone via Digitalmars-d-learn
On Tuesday, 8 June 2021 at 00:54:41 UTC, someone wrote: Are there alternatives to nested classes for such scenarios ? Self-reply: I created two files for classComputers and classComputer and I replaced the nested-classComputer code within classComputers with: import classComputers; But it

best approach to code hierarchical classes ?

2021-06-07 Thread someone via Digitalmars-d-learn
Consider the following code in what I used nested-classes for the first time within D: ```d import std.string; import std.stdio; class classComputers { classComputers lhs; classComputers rhs; int opApply(int delegate(classComputer) dg) { /// boilerplate code to handle the class's