Monday 29 June 2015

Which class can not be inherited from object class?

None!. All clases are inherited from system.object clas. If class not inherited from system.object class then why all the class have .ToString(),GetHashCode and other object inherited functions.
I have read many blogs and answers some are saying that sealed and abstract class can not be inherited from system.object class. But it is wrong.

System.Object class is the parent class of all the classes. By the definition of class sealed and abstract class , definitions saying that you can inherite the class or you cann’t make derived from these class . It is not saying it s not inherited from system.Object class. So we definitely say that all the class is inhetited from system.Object class.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.