代码
namespace First
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
Employee E1
= new Employee("xiaohong","you");
E1.Salary
=4.2m;
E1.printEmployee();
this.Close();
}

private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(
"Hi");
this.Close();
}
}
class Employee
{
private string name;
private string alias;
private decimal salary;
public Employee(string name, string alias)
{
this.name = name;
this.alias = alias;
}
public decimal Salary
{
get
{
return salary;
}
set
{
salary
= value;
}
}

public void printEmployee()
{
MessageBox.Show(
"Name:" + name +"\n"+ "Alias:" + alias +"\n"+ "num:" + salary);
// MessageBox.Show( Employee.SalcTax(this));

}
}
}

 

代码
namespace First
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
Employee E1
= new Employee("xiaohong","you");
E1.Salary
=1.10m;
E1.printEmployee();
this.Close();
}
}
class Employee
{
private string name;
private string alias;
private decimal salary;
public Employee(string e, string s)
{
this.name = e;
this.alias = s;
}
public decimal Salary
{
get
{
return salary;
}
set
{
salary
= value;
}
}
public static decimal SalcTax(Employee E)
{
return 3* E.Salary;
}
public void printEmployee()
{
MessageBox.Show(
"Name:" + name + "\n" + "Alias:" + alias + "\n" + "Salary" + Employee.SalcTax(this));
// MessageBox.Show( Employee.SalcTax(this));

}
}
}

 

 

 

相关文章:

  • 2022-02-10
  • 2021-11-07
  • 2022-01-19
  • 2021-12-26
  • 2021-10-28
  • 2022-12-23
猜你喜欢
  • 2022-02-05
  • 2022-12-23
  • 2021-05-17
  • 2021-10-11
  • 2021-08-12
  • 2022-12-23
  • 2022-01-12
相关资源
相似解决方案