Exercise at end of Ch. 56 of "Programming in D"

2022-08-14 Thread johntp via Digitalmars-d-learn
I'm using DMD64 D Compiler v2.100.0 on linux mint. I kept getting an assertion error for my solution to the exercises at the end of Chapter 56 of "Programming in D", so I copied the author's solution and got the same thing. The exercise is the very last one (exercise 3) about overriding ```d

Re: Exercise at end of Ch. 56 of "Programming in D"

2022-08-14 Thread johntp via Digitalmars-d-learn
On Monday, 15 August 2022 at 02:23:34 UTC, Ali Çehreli wrote: Wow! Are people actually working on those? :) Absolutely. Thanks for the book. I'm enjoying it. At first, I couldn't even get the code to compile due to const-correctness issues with opCmp. :/ I used the following cast():

Re: Exercise at end of Ch. 56 of "Programming in D"

2022-08-14 Thread johntp via Digitalmars-d-learn
On Monday, 15 August 2022 at 02:59:59 UTC, Ali Çehreli wrote: On 8/14/22 19:23, Ali Çehreli wrote: class Point { int x; int y; Color color; // ... override size_t toHash() const { return x + y; I just saw this second reply. Might not be good if you have Point(1,2) and