Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Pracownik
- {
- public string nazwisko;
- public double Zarobki { get; set; } // automatyczna właściwość
- public void PokazPracownika() // metoda
- {
- Console.WriteLine("{0,-15} {1,10}", nazwisko, Zarobki);
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Pracownik p1 = new Pracownik();
- p1.nazwisko = "Kowalski";
- p1.Zarobki = 1250.0; // użycie akcesora set
- p1.PokazPracownika();
- Console.WriteLine(p1.Zarobki); // użycie akcesora get
- Console.ReadKey();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement