Use Sealed class to stop Inheritance. The following Example can give brief idea
Public Sealed class A
{
Public int x=10;
Public int m()
{
return 20;
}
}
Public Class B : A //compilation will give error
{
Public int y=10;
Public string m1()
{
return 10;
}
Public Sealed class A
{
Public int x=10;
Public int m()
{
return 20;
}
}
Public Class B : A //compilation will give error
{
Public int y=10;
Public string m1()
{
return 10;
}
No comments:
Post a Comment