I was asked in interview that if i have created a class and i don't want the class to be inherited by any other members without me which key or function i have to use?

Showing Answers 1 - 16 of 16 Answers

suhail

  • Oct 14th, 2006
 

the class which u dont want to restrict to inherit in c# , declare with sealed keyword

and notinherit keyword in vb.net

PraveenKumar

  • Feb 20th, 2007
 

BY using MyClass keyword.

  Was this answer useful?  Yes

raghavendran

  • Feb 28th, 2007
 

Use Not Inheritable in class to avoid inheriting that class.

  Was this answer useful?  Yes

tfouda

  • Aug 13th, 2007
 

VB: for class NotInheritable [MyClass]
     For method: NotOverridable [MyMethod]


C# For class or method :sealed[MyClassMyMethod]{}

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions