来自子类的父类 [英] Parent class from child class

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

问题描述

如何从子类调用父类的相同函数

How to call same function of parent class from child class

推荐答案

父类和子类在.Net中是奇怪的名称

Parent class and child class are strange names in .Net

如果您指的是基类和派生类,那么您可以在不覆盖该方法的情况下调用该方法。 

If you mean base and derived class then you can if the method is not overridden call the method. 

如果它被覆盖(或阴影),那么你可以转换为基类。 

If it is overridden (or shadowed) then you can cast to the base class. 

在VB DirectCast(TheDerivedClass,TheBaseClass).TheMethod

In VB DirectCast(TheDerivedClass, TheBaseClass).TheMethod

在C#中

(TheBaseClass)TheDerivedClass.TheMethod();

(TheBaseClass) TheDerivedClass.TheMethod();


这篇关于来自子类的父类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆