【发布时间】:2025-03-31 01:35:01
【问题描述】:
我有这个基类:
abstract class Base
{
public int x
{
get { throw new NotImplementedException(); }
}
}
还有以下后代:
class Derived : Base
{
public int x
{
get { //Actual Implementaion }
}
}
当我编译时,我收到这个警告,说 Derived 类对 x 的定义将隐藏 Base 的版本。是否可以在 c# 中覆盖类似方法的属性?
【问题讨论】:
标签: c# inheritance properties polymorphism overriding