-
using System;using System.Collections.Generic;class A{ public void Demo() { Console.WriteLine(The Demo is called); }} class Test { static void Main(string[] args) { A a=new A(); a.Demo(); } }
-
using System;using System.Collections.Generic;class A{ protected void Demo() { Console.WriteLine(The Demo is called); }} class Test { static void Main(string[] args) { A a=new A(); a.Demo(); } }
-
using System;using System.Collections.Generic;class A{ protected void Demo() { Console.WriteLine(The Demo is called);}}class B:A { public B() { Demo(); } static void Main(string[] args) { B b=new B(); } }
-
none of the above
-
both (2) and (3)
This code will give compile error protected members can be accesses either in the same class or in the base class of that class. These protected members cannot be accessed outside the class.