![]() |
IT-Interview.com:Open Database for IT Professionals to share interview questions, answers and knowledge. |
![]() |
IT-Interview.com:Open Database for IT Professionals to share interview questions, answers and knowledge. |
i was asked in interview that if i have created a class and i dont want the class to be inherited by any other members without me which key or function i have to use?
asked by: miss_chocolates on: Aug 16, 2009
Best Answer ! ! !
the class which u dont want to restrict to inherit in c# , declare with sealed keyword
and notinherit keyword in vb.net

the class which u dont want to restrict to inherit in c# declare with sealed keyword
and notinherit keyword in vb.net
starfishie answered on£ºAug 17, 2009 0 comments 
BY using MyClass keyword.
luzverde answered on£ºAug 19, 2009 0 comments
Use Not Inheritable in class to avoid inheriting that class.
hotgamermum answered on£ºAug 21, 2009 0 comments 
VB: for class NotInheritable [MyClass]
For method: NotOverridable [MyMethod]
C# For class or method :sealed[MyClassMyMethod]{}
ryun0suk3 answered on£ºAug 22, 2009 0 comments
Use NonInheritable class classname
ladiida answered on£ºAug 24, 2009 5 comments
By using Sealed Class it will be possible.
tengyong answered on£ºAug 26, 2009 0 comments