Casting between two types derived from the (same) interface

前端 未结 9 2044
南方客
南方客 2020-12-20 12:55

I have an interface and two types that derive from it.

However, I cannot do the following:

B objectB = (B) objectA

Where B derives

9条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-20 13:31

    What you want to do doesn't make sense. objectA is not a B.

提交回复
热议问题