Advertisement
simonradev

Da

Nov 24th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             B b = new B();
  14.  
  15.             string firstResult = b.Result();
  16.             string secondResult = ((A)b).Result();
  17.  
  18.             Console.WriteLine(firstResult);
  19.             Console.WriteLine(secondResult);
  20.         }
  21.     }
  22.  
  23.     class A
  24.     {
  25.         public string Result()
  26.         {
  27.             return "A";
  28.         }
  29.     }
  30.  
  31.     class B : A
  32.     {
  33.         public string Result()
  34.         {
  35.             return "B";
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement