On Saturday, 6 June 2015 at 10:20:34 UTC, Marc Schütz wrote:
Because `SList` is a struct, which is a value type that is
allocated where you declare it (here on the stack), while you
used a class, which is a reference type and has to be allocated
with `new`.
You can also turn your `Stack` type into a struct, then it
works, too. (You just need to remove the constructor, which is
empty anyway.)
That makes sense. I overlooked that in SList's documentation and
thought it was just a regular old class, too.
Best regards,
Tim