Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class A
- {
- public virtual int Prva() { return 10; }
- public virtual int Druga() { return 8; }
- }
- class B:A
- {
- public override int Prva() { return 3; }
- public new int Druga() { return 7; }
- }
- class C:B
- {
- public override int Prva() { return 4; }
- public new virtual int Druga() { return 3; }
- }
- class D:C
- {
- public new int Druga() { return 2; }
- public override int Prva()
- {
- return 3;
- }
- }
- class Broj
- {
- static void Main(string[] args)
- {
- int[] niz=new int[5];
- int broj = 150;
- A x = new B(); broj += x.Prva(); broj += x.Druga();
- A y = new D(); broj += y.Prva(); broj += y.Druga();
- Console.WriteLine(broj);
- Console.ReadLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement