Advertisement
nikitaTheSlayer

Lesson: OOP_1

Feb 4th, 2022
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Administrirovanie_Kafe
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Player player = new Player("Никита", "Россия", 23);
  10.  
  11.             player.ShowInfo();
  12.         }
  13.     }    
  14.  
  15.     class Player
  16.     {
  17.         private string _name;
  18.         private string _country;
  19.         private int _age;
  20.  
  21.         public Player(string name, string country, int age)
  22.         {
  23.             _name = name;
  24.             _country = country;
  25.             _age = age;
  26.         }
  27.  
  28.         public void ShowInfo()
  29.         {
  30.             Console.WriteLine($"Имя игрока - {_name}, страна игрока - {_country}, возраст игрока - {_age}");
  31.         }
  32.     }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement