Sorry didn't get any funky title for the question.
I had been taught that .Net(C#) doesn't support Multiple Inheritance. But looking at the foo example below I wonder is this really truth ??
class fooList
{
public int Index()
{
return 0;
}
}
class foo : fooList
{
public foo()
{ }
}
class testFoo
{
void test()
{
foo obj = new foo();
// From object
obj.Equals(obj);
obj.GetHashCode();
obj.GetType();
obj.ToString();
// From fooList
obj.Index();
}
}
As we can see that I have a class fooList and a class foo which inherits fooList according to the sayings(C# doesn't support Multiple Inheritance) the object of class foo should have only one method which is Index() from the fooList class, But it has more methods from the object class. It clearly indicates that by default all the classes inherit object class. So questions raises
- Is it really completely true that C# doesn't support Multiple Inheritance ?
- I guess it supports it at CLR level, Than why it doesn't support it in coding ?
class fooListis a shorthand forclass fooList : object. That should clear your confusion.