Answer: Sealed class is declared with
Sealed keyword.
Syntax:-
sealed class credit
{
public int Add(int a,int b)
{
return a + b;
}
}
As sealed class do not need to be derived means if we declare any class as Sealed class,then no body can enforce to inherit.If we take an example of Credit card,then it's information need not be shared by any one.So we can make such class as sealed.
Asked In: Many Interviews |
Alert Moderator