Ziomnexpl

klasy

Mar 28th, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. using System;
  2.  
  3. namespace test_0
  4. {
  5.     internal class Program
  6.     {
  7.         private static void Main(string[] args)
  8.         {
  9.             Pies burek = new Pies("bury", 13, "kundel");
  10.             Pies azor = new Pies("biały", 50, "maltanczyk");
  11.             Console.WriteLine(burek.kolorSiersci);
  12.             Console.WriteLine(azor.waga);
  13.             Console.WriteLine(azor.Szczekaj());
  14.             Console.ReadKey();
  15.         }
  16.     }
  17.  
  18.     public class Pies //deklaruje klase Pies
  19.     {
  20.         //pola klasy
  21.  
  22.         public string kolorSiersci;
  23.         public ushort waga;
  24.         public string rasa;
  25.  
  26.         public string Szczekaj()
  27.         {
  28.             return "hauhau";
  29.         }
  30.  
  31.         //metody klasy
  32.         public Pies(string kolorSiersci, ushort waga, string rasa)
  33.         {
  34.             this.kolorSiersci = kolorSiersci;
  35.             this.waga = waga;
  36.             this.rasa = rasa;
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment