Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace OOPTask1ClassPlayer
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- List<Player> players = new List<Player>();
- players.Add(new Player("Вася", "задрот", 27));
- players.Add(new Player("Петя", "читер", 14));
- players.Add(new Player("Гена", "ламер", 17));
- foreach (Player player in players)
- {
- player.ShowInfo();
- }
- }
- }
- class Player
- {
- private string _name;
- private string _description;
- private int _age;
- public Player(string name, string description, int age)
- {
- _name = name;
- _description = description;
- _age = age;
- }
- public void ShowInfo()
- {
- Console.WriteLine($"Игроку {_name} {_age} лет и он {_description}.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement