The cast operator is of lower precedence than the member access operator.
(A)B.C();
is parsed as
(A)(B.C());
which is not a legal statement. You ought to write
((A)B).C();
if you mean to cast B
to A
and then call C()
on type A
.
For your future reference, the precedence table is here:
http://msdn.microsoft.com/en-us/library/aa691323(v=VS.71).aspx