Advertisement
Dr_Max_Experience

Task 1

Feb 17th, 2022
1,116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ООП
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Player player1 = new Player("Max", 20);
  10.  
  11.             player1.ShowInfo();
  12.         }
  13.     }
  14.  
  15.     class Player
  16.     {
  17.         public string Name { get; private set; }
  18.         public int Age { get; private set; }
  19.  
  20.         public Player(string name, int age)
  21.         {
  22.             Name = name;
  23.             Age = age;
  24.         }
  25.  
  26.         public void ShowInfo()
  27.         {
  28.             Console.WriteLine($"Меня зовут {Name}, мне {Age}.");
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement