On Monday, 13 December 2021 at 22:06:45 UTC, chopchop wrote:
If I remove the ref, it works as expected, that is to say I can give a derived class as parameter.

Why are you using the ref to begin with?

What the logic here?

Consider this:


class C : A {}

void incr(ref A a) {
   a = new C;
}

B b = new B;
incr(b);
// oops b now got rebound to a C instead of to a B, which breaks everything

Reply via email to