public class Powwow
{
Name
private string name;
public string Name
{
get {return name;}
set {name = value;}
}
Health value
private int blood;
public int Blood
{
get {return blood;}
set {blood = value;}
}
Combat effectiveness
private int power;
public int Power
{
get {return power;}
set {power = value;}
}
Level
private int level;
public int Level
{
get {return level;}
set {level = value;}
}
A constructor that has a parameter
Public Powwow (String name,int power,int level)
{
This. name = name;
This. Blood = 10000;
This. Power = power;
This. level = level;
}
Non-parametric constructors
Public Powwow ()
{
THIS.name = "Master Wang";
This. Blood = 10000;
This. Power = 100;
This.level = 3;
}
Overloaded methods
Public Powwow (String Name,int blood,int power, int. level)
{
This. name = name;
This. Blood = Blood;
This. Power = power;
This. level = level;
}
}
--------------------------------------------------------------------------------------------------------------- -------------------------------------------
Class Program {
static void Main (string[] args)
{
Powwow pw = new Powwow ();
Console.WriteLine ("The sorcerer's name {0}, health is {1}, fighting capacity {2}, level {3}", PW. Name, PW. Blood, PW. Power, PW. level);
Powwow pw1=new powwow ("East Poison West Xu", 1000,2);
Console.WriteLine ("The sorcerer's name {0}, health is {1}, fighting capacity {2}, level {3}", Pw1. Name,pw1. Blood,pw1. Power,pw1. level);
Powwow pw2 = new Powwow ("Master Poison", 6000, 98, 1);
Console.WriteLine ("The sorcerer's name {0}, health is {1}, fighting capacity {2}, level {3}", Pw2. Name, Pw2. Blood, Pw2. Power, Pw2. level);
Console.ReadLine ();
}
}
S2T40 in-depth. NET platform and C # programming simple answer 52017-4-6