小编sto*_*8us的帖子

抽象类继承另一个抽象类问题

我有一个继承架构,如下所示:

public abstract class BaseAttachment
{
    public abstract string GetName();
}

public abstract class BaseFileAttachment:BaseAttachment
{
    public abstract string GetName();
}

public class ExchangeFileAttachment:BaseFileAttachment
{
    string name;
    public override string GetName()
    {
        return name;
    }
}
Run Code Online (Sandbox Code Playgroud)

我基本上想调用ExchangeFileAttachment类的GetName()方法; 但是,上述声明是错误的.对此有任何帮助表示赞赏.谢谢

.net c# inheritance abstract-class encapsulation

5
推荐指数
2
解决办法
2万
查看次数

标签 统计

.net ×1

abstract-class ×1

c# ×1

encapsulation ×1

inheritance ×1