locked
system.object RRS feed

  • Question

  • I've a doubt about inheritance in c#, suppose there are two classes, class A and class B and both are derived from system.object. Now Class B inherits Class A, that means multiple inheritance, how comes that possible, coz c# doesn't support multiple iheritance. Any suggestion would be appretiated.

    shine
    Thursday, December 22, 2005 12:44 PM

All replies

  • If B derives directly from A, then Object isn't the immediate base class of B. All classes derives from Object one way or another, but there may be any number of base classes in between in the inheritance hierarchy. It's

      B

      ^

      A

      ^

     Object

     

    not

          B

      ^       ^

      A      Object

      ^

    Object

     

    Thursday, December 22, 2005 2:04 PM
  • Multiple inheritance would mean a class C inheriting from both A and B:

    class A { }

    class B { }

    class C : A, B { /* not allowed */ }

     

     

    Thursday, December 22, 2005 3:04 PM