Multiple choice technology programming languages

Consider a class inheriting another class and 2 interfaces. Which of the following statements is true?

  1. .Net doesnot support multiple inheritance. Hence cannot inherit all the 3, results in error.

  2. .Net allows to inherit only 1 class and 1 interface, hence error.

  3. The class has to be inherited first and then the interfaces.

  4. The interface has to be inherited first then class.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In .NET, a class can inherit from exactly one base class but implement multiple interfaces. The syntax requires the base class to be listed first, followed by interfaces: class Derived : Base, I1, I2. Option A is incorrect because interfaces circumvent the multiple inheritance restriction. Option B is wrong because .NET allows implementing multiple interfaces. Option D is incorrect because the base class must precede interfaces in the declaration.