Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is System.Object not abstract in .NET?

Tags:

.net

oop

I know it is commonly used as a lock object, but is that really sufficient reason? What is the meaning of

object o = new object();

An non-abstract class is something that represents actual objects. "asdasdf" is a string. What actual instance can there be of "object" class? It doesn't make sense, OOP-wise. My question is if there is some practical reason for its existence (besides being used as a lock object).

like image 231
ripper234 Avatar asked Jan 27 '09 16:01

ripper234


People also ask

What is .NET System object?

The Object class is the base class for all the classes in the . Net Framework. It is present in the System namespace. In C#, the . NET Base Class Library(BCL) has a language-specific alias which is Object class with the fully qualified name as System.

Is the object class abstract?

An abstract object class is much like an abstract Java class in that just as you can't directly instantiate an abstract Java class but must instantiate a non-abstract subclass, you can't create an entry with an abstract object class unless the entry has at least one non-abstract object class that inherits from that ...

Can we create object for abstract class in C#?

Abstract class: is a restricted class that cannot be used to create objects (to access it, it must be inherited from another class).

Is it mandatory to implement abstract methods in C#?

An abstract method must be implemented in all non-abstract classes using the override keyword. After overriding, the abstract method is in the non-Abstract class. We can derive this class in another class, and again we can override the same abstract method with it.


1 Answers

The easiest way to answer that question is to ask another one: is there any reason for the Object class to be abstract? Since there is no reason for it to be abstract, it's not.

like image 164
Vojislav Stojkovic Avatar answered Sep 23 '22 00:09

Vojislav Stojkovic