Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1.  class A
  2.     {
  3.         public virtual int Prva() { return 10; }
  4.         public virtual int Druga() { return 8; }
  5.        
  6.     }
  7.  
  8.     class B:A
  9.     {
  10.         public override int Prva() { return 3; }
  11.         public new int Druga() { return 7; }
  12.  
  13.     }
  14.  
  15.     class C:B
  16.     {
  17.         public override int Prva() { return 4; }
  18.         public new virtual int Druga() { return 3; }
  19.  
  20.     }
  21.     class D:C
  22.     {
  23.         public new int Druga()  { return 2; }
  24.         public override int Prva()
  25.         {
  26.             return 3;
  27.         }
  28.     }
  29.     class Broj
  30.     {
  31.  
  32.         static void Main(string[] args)
  33.         {
  34.             int[] niz=new int[5];
  35.             int broj = 150;
  36.             A x = new B(); broj += x.Prva(); broj += x.Druga();
  37.             A y = new D(); broj += y.Prva(); broj += y.Druga();
  38.             Console.WriteLine(broj);
  39.             Console.ReadLine();
  40.         }
  41.  
  42.  
  43.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement