我有两个类:
public class A
{
}
public sealed class B : A
{
}
而且我希望只有我的 B
类(在 A
的同一程序集中定义)可以继承 A
。
我该怎么办?
最佳答案
And I want that only my B class (defined in the same assembly of A) can inherits A. How can I do?
那么根本不需要继承..
public sealed class B
{
//includes all methods of A and B
}
关于c# - 如何强制单继承?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13086405/