使用新的关键字orverriding [英] Use of New Keyword orverriding
本文介绍了使用新的关键字orverriding的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想了解c中的新关键字#
i want to know about new keyword in c#
class A
{
public virtual void abc()
{
Console.Write("A");
}
}
class B:A
{
public new virtual void abc()
{
base.abc();
Console.Write("B");
}
}
Thanx问候,
Ankush Sharma
Thanx with regards,
Ankush Sharma
推荐答案
在上面的代码中,B类将隐藏A类中的基本方法abc。
我认为这些链接足以回答你的问题。
新的在C#中 [ ^ ]
了解C#中的虚拟,覆盖和新关键字 [ ^ ]
C#New Modifier [ ^ ]
覆盖和新的有什么区别? [ ^ ]
问候..:笑:
In your above code,class B will hide the base method abc in class A.
I think these links would be enough to answer your question.
new in C#[^]
Understanding virtual, override and new keyword in C#[^]
C# New Modifier[^]
What's the difference between override and new?[^]
Regards..:laugh:
这篇关于使用新的关键字orverriding的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文