locked
Why System.Object class is not made abstract? RRS feed

  • Question

  • Whats will the problem if Object class is made abstract?
    Friday, August 7, 2009 11:56 AM

Answers

  • You wouldn't be able to box anymore.  The framework would stop working.

    Hans Passant.
    • Marked as answer by eryang Friday, August 14, 2009 6:26 AM
    Saturday, August 8, 2009 4:32 PM
  • One point of an abstract class is that it has some methods/properties that needs to be implemented in derived classes (not a requirement, but very common). The Object class has no such methods/properties. Therefore it makes no sense to let it be abstract.

    Also, sometimes it is convenient to have an object that is nothing else but an object. This is very useful for thread syncronization, or for indicating that a reference type variable is something else than null.

    I don't think it would be a problem to have it as abstract, but there is no reason why it should be.

    These are only my opinions. Maybe the MS guys have some other...

    Tor-Odd Connelly
    • Marked as answer by eryang Friday, August 14, 2009 6:26 AM
    Friday, August 7, 2009 12:34 PM

All replies

  • One point of an abstract class is that it has some methods/properties that needs to be implemented in derived classes (not a requirement, but very common). The Object class has no such methods/properties. Therefore it makes no sense to let it be abstract.

    Also, sometimes it is convenient to have an object that is nothing else but an object. This is very useful for thread syncronization, or for indicating that a reference type variable is something else than null.

    I don't think it would be a problem to have it as abstract, but there is no reason why it should be.

    These are only my opinions. Maybe the MS guys have some other...

    Tor-Odd Connelly
    • Marked as answer by eryang Friday, August 14, 2009 6:26 AM
    Friday, August 7, 2009 12:34 PM
  • You wouldn't be able to box anymore.  The framework would stop working.

    Hans Passant.
    • Marked as answer by eryang Friday, August 14, 2009 6:26 AM
    Saturday, August 8, 2009 4:32 PM