Multiple choice

What is the error in the following code? using System;using System.Collections.Generic;sealed class A { protected void Demo() { Console.WriteLine(The Demo is called); } } class B:A { static void Main(string[] args) { B a = new B(); a.Demo(); } }

  1. Protected members can not be accessed in the subclass.

  2. Base class can not be inherited.

  3. Base can class can not be a type of sealed.

  4. The code will produce exception.

  5. No error

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

Yes, class A is of sealed type and we can not inherit a sealed class.