本文介绍了获取基类类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




假设我有一个名为A的类继承自B,它继承自C.



GetType(A).BaseType返回GetType(C);我可以将A转换为C来获得C.



如何判断A是否使用其类型从B继承?我需要使用B的方法。



- Rix



我的尝试:



几个小时尝试各种基于继承的东西

解决方案

Hi
Let's say I have a class called A which inherits from B, which inherits from C.

GetType(A).BaseType returns GetType(C); I could cast A to C to get C.

How can I figure out whether A inherits from B using its type? I need to use B's methods.

- Rix

What I have tried:

A few hours of trying various inheritance-based things

解决方案


这篇关于获取基类类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 15:24