Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.29 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. namespace zadanie1
  8. {
  9.     public class samochod
  10.     {
  11.         string marka, model;
  12.         int ilosc_drzwi;
  13.         double sredn_spalenie;
  14.         int pojemnosc_silnika;
  15.         int liczba_samochodow = 0;
  16.         public samochod(string marka_ = "", string model_ = "", int ilosc_drzwi_ = 0)
  17.         {
  18.             this.marka = marka_;
  19.             this.model = model_;
  20.             this.ilosc_drzwi = ilosc_drzwi_;
  21.             liczba_samochodow++;      
  22.         }
  23.          
  24.         int get_number() { return liczba_samochodow; }
  25.         public string get_marka() { return marka; } public string get_model() { return model; }
  26.     }
  27. }
  28.  
  29. ///////////////////////
  30.  
  31. using System;
  32. using System.Collections.Generic;
  33. using System.Linq;
  34. using System.Text;
  35. using System.Threading.Tasks;
  36.  
  37. namespace zadanie1
  38. {
  39.     class Program
  40.     {
  41.         static void Main(string[] args)
  42.         {
  43.             samochod S = new samochod("Mazda", "RX-8", 2);
  44.             samochod S1 = new samochod("BMW", "M4", 2);
  45.             samochod S2 = new samochod("Audi", "RS-6 Evhotech", 4);
  46.             Console.WriteLine(S.get_number());
  47.             Console.ReadLine();
  48.         }
  49.  
  50.     }
  51.    
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement