generated from admin/template
puuush
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
namespace DefaultNamespace;
|
||||||
|
|
||||||
|
public class ex1
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Pokemon pikachu = new Pokemon("Пикачу", 5, 100);
|
||||||
|
Pokemon sqr = new Pokemon("Сквиртл", 7, 90);
|
||||||
|
|
||||||
|
pikachu.ShowInfo();
|
||||||
|
sqr.ShowInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Pokemon
|
||||||
|
{
|
||||||
|
private string name;
|
||||||
|
private int level;
|
||||||
|
private int hp;
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return name; }
|
||||||
|
set { name = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Level
|
||||||
|
{
|
||||||
|
get { return level; }
|
||||||
|
set { level = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Hp
|
||||||
|
{
|
||||||
|
get { return hp; }
|
||||||
|
set { hp = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pokemon(string name, int level, int hp)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.level = level;
|
||||||
|
this.hp = hp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowInfo()
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Имя: {this.Name}, Уровень: {this.Level}, HP: {this.Hp}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user