Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1.  
  2.  
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace _3b
  10. {
  11.     abstract class Telephone
  12.     {
  13.         protected string phonetype;
  14.         public abstract void Ring();
  15.     }
  16.     class DigitalPhone : Telephone
  17.     {
  18.         public DigitalPhone()
  19.         {
  20.             this.phonetype = "Digital";
  21.         }
  22.         public override void Ring()
  23.         {
  24.             Console.WriteLine("Dzwoni w chuj " + this.phonetype);
  25.         }
  26.     }
  27.     class TalkingPhone : Telephone
  28.     {
  29.         public TalkingPhone()
  30.         {
  31.             this.phonetype = "Talking";
  32.         }
  33.         public override void Ring()
  34.         {
  35.             Console.WriteLine("Dzwoni w chuj " + this.phonetype);
  36.         }
  37.     }
  38.     class Program
  39.     {
  40.         static void Main(string[] args)
  41.         {
  42.             DigitalPhone EP1 = new DigitalPhone();
  43.             TalkingPhone EP2 = new TalkingPhone();
  44.             EP1.Ring();
  45.             EP2.Ring();
  46.             Console.ReadKey();
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement