Nic*_*ick 3 .net c# inheritance
我有两节课:
public class A
{
}
public sealed class B : A
{
}
Run Code Online (Sandbox Code Playgroud)
我希望只有我的B
类(在同一个程序集中定义A
)才能继承A
.
我能怎么做?
而且我希望只有我的B类(在A的同一个程序集中定义)才能继承A.我该怎么办?
那时根本不需要继承..
public sealed class B
{
//includes all methods of A and B
}
Run Code Online (Sandbox Code Playgroud)