Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace HW_5_1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Player player = new Player("William", "Russia", "vova@ya.ru");
- player.WritePlayerInfo();
- }
- }
- class Player
- {
- private string _name, _country, _email;
- private int _experience;
- public Player(string name, string country, string email)
- {
- _name = name;
- _country = country;
- _email = email;
- _experience = 0;
- }
- public Player(string name, string email)
- {
- _name = name;
- _email = email;
- _experience = 0;
- }
- public string Name
- {
- get
- {
- return _name;
- }
- set
- {
- _name = value;
- }
- }
- public string Country
- {
- get
- {
- return _country;
- }
- set
- {
- _country = value;
- }
- }
- public int Experience
- {
- get
- {
- return _experience;
- }
- }
- public void AddExperience(int exp)
- {
- _experience += exp;
- }
- public void WritePlayerInfo()
- {
- Console.WriteLine($"Player: {_name} \nemail: {_email}\nexperience: {_experience}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement