What is the syntax of Sealed Class in C#?

 Posted by vishalneeraj-24503 on 11/2/2014 | Category: OOPS Interview questions | Views: 644 | Points: 40
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 

Comments or Responses

Login to post response