What will be printed out as a result of the following code execution?
 
class Program { 
         class A { 
             public virtual void Print() {           
                 Console.WriteLine("A::Print"); 
             }
     }
    
     class B : A { 
         public override void Print() {       
             Console.WriteLine("B::Print"); 
          }
      } class C : B { 
           public new void Print() { 
                base.Print(); 

               Console.WriteLine("C::Print"); 
         }
     } 

     static void Main(string[] args) { 
        A a = new A(); 
        A b = new B(); 
        A c = new C(); 

        a.Print(); 
        b.Print(); 
        c.Print(); 

       Console.ReadKey(); 
      } 
 }
 

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback