I recently took a practice C# skills test and one of the questions was,
Does C# support multiple inheritance?
I answered yes, and was was marked wrong. After some research online, its full of answers of why it is not supported:
Multiple inheritance support in C#
Why is Multiple Inheritance not allowed in Java or C#?
http://www.codeproject.com/Questions/652495/Why-does-csharp-doesnt-support-Multiple-inheritanc
Then I went and tried to replicate the error I should be getting when trying to inherit from a Class that already inherited from a Base Class, and there is no error. I am using console application, and I recently upgraded to .net 4.5, maybe things have changed?
Code for how I tested:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Leo bk = new Leo();
bk.avgWords();
Console.ReadLine();
}
public void bubbleSort(int[] input)
{
}
public void insertionSort(int[] input)
{
}
}
public class Gatsby : Books
{
public override void avgWords()
{
Console.WriteLine(5);
}
}
public class Leo : Gatsby
{
public override void avgWords()
{
Console.WriteLine(7);
}
}
public class Dicaprio : Leo
{
}
public class Books
{
public int id { get; set; }
public string title { get; set; }
public string author { get; set; }
public virtual void avgWords()
{
Console.WriteLine(3);
}
}
}