The following code does not compile:
struct S { }
class A
{
S s;
alias s this;
}
class B : A
{
}
void main()
{
A asA = new B;
B asB = cast(B)asA;
}
I would expect the last line to successfully cast the B instance
I created back into type B, however this seems to be preempted by
the alias this:
Error: cannot cast expression asA.s of type S to app.BIs there a way to force this cast to operate on the object of type A instead of automatically using A.s?
Thanks, Aurelien
