Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 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. using System.IO;
  7.  
  8. namespace test
  9. {
  10. class Class1
  11. {
  12. public virtual void Metoda()
  13. {
  14. Console.Write("Metoda1");
  15. }
  16.  
  17. }
  18.  
  19. class Class2:Class1
  20. {
  21. public override void Metoda()
  22. {
  23. Console.Write("Metoda2");
  24. }
  25. }
  26.  
  27. /* public static void Main()
  28. {
  29. Class2 obj2 = new Class2();
  30. obj2.Metoda();
  31.  
  32. Console.Write(",");
  33.  
  34. Class1 obj1 = (Class1)obj2;
  35. obj1.Metoda();
  36. }*/
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement