Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.84 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. class Osoba
  8. {
  9.     protected string imie = null;
  10.     protected string data = null;
  11.     protected string nazwisko = null;
  12.     public Osoba(string imie_, string data_, string nazwisko_)
  13.     {
  14.         imie = imie_;
  15.         data = data_;
  16.         nazwisko = nazwisko_;
  17.     }
  18.     internal void WypiszInfo()
  19.     {
  20.         throw new NotImplementedException();
  21.     }
  22.  
  23.     internal void StrzelGola()
  24.     {
  25.         throw new NotImplementedException();
  26.     }
  27. }
  28. class Student: Osoba
  29. {
  30.     private int rok;
  31.     private int grupa;
  32.     private int nrIndeksu;
  33.  
  34.     public Student (string imie_, string data_, string nazwisko_, int rok_, int grupa_, int nrIndeksu_) : base(imie_, data_, nazwisko_)
  35.     {
  36.         rok_ = rok;
  37.         grupa_ = grupa;
  38.         nrIndeksu_ = nrIndeksu;
  39.     }
  40. }
  41. class Pilkarz : Osoba
  42. {
  43.     private string pozycja;
  44.     private string klub;
  45.  
  46.     public Pilkarz(string imie_, string data_, string nazwisko_, string pozycja_, string klub_) : base(imie_, data_, nazwisko_)
  47.     {
  48.         pozycja_ = pozycja;
  49.         klub_ = klub;
  50.     }
  51. }
  52.  
  53. static void Main(string[] ards)
  54. {
  55.     Osoba o = new Osoba("Adam", "Mis", "20,03,1980");
  56.     Osoba o2 = new Student("Michal", "Kot", "13.04.1990", 2, 1, 12345);
  57.     Osoba o3 = new Pilkarz("Mateusz", "Zbik", "10.08.1984", "obronca", "FC Czestochowa");
  58.  
  59.     o.WypiszInfo();
  60.     o2.WypiszInfo();
  61.     o3.WypiszInfo();
  62.  
  63.     Student s = new Student("Krzysztof", "Jez", "22.12.1990", 2, 5, 54321);
  64.     Pilkarz p = new Pilkarz("Piotr", "Kos", "14.09.1984", "napastnik", "FC Politechnika");
  65.  
  66.     s.WypiszInfo();
  67.     p.WypiszInfo();
  68.  
  69.     o3.StrzelGola();
  70.     p.StrzelGola();
  71.     p.StrzelGola();
  72.  
  73.     o3.WypiszInfo();
  74.     p.WypiszInfo();
  75.  
  76.     Console.ReadKey();
  77.  
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement