C#.NET Multiple choices


Total available count: 28
Subject - Microsoft Technologies
Subsubject - C#.NET

Why C# doesn't support Multiple Inheritance?


 

 

 

 



C


Solution:-

Multiple inheritance doesn't support by C#:
The above code is wrong in C# because the new class is created from class "FirstClass" and class "SecondClass". The reason is that C# does not allows multiple inheritance. There are several reasons for this implementation, but it mostly comes down to that multiple inheritance introduces much more complexity into a class hierarchy.

  Class FirstClass { }
  Class SecondClass { }
   
    interface X { }
    interface Y { }

You can inherit like the following:

class NewClass : X, Y { }

The class "NewClass" is created from multiple interfaces, In the above code.

class NewClass : FirstClass, X { }

The class "NewClass" is created from interface X and class "FirstClass", In the above code.

WRONG: 

class NewClass : FirstClass, SecondClass { }



Next 5 multiple choice(s)

1

A static method____

2

Which of the following interface to be implemented to disponse an object externally?

3

Creating a static class is the same as creating _______

4

By default interface methods are?

5

What will be the output of the below?

class BaseClass
{
  public void Slightbook()
  {
     Console.WriteLine("SlightBook questions");
  }
}
class DerivedClass:BaseClass
{
  public void Slightbook()
  {
     Console.WriteLine("SlightBook choices");
  }
}
class program
{
  static void Main(string[] args)
  {
     BaseClass bd = new DerivedClass();
     bd.Slightbook();
  }
}

 

Comments