C#新建控制台项目Salary,建立雇员类、老板类、销售员类以及计件工人类,其中雇员类为基类,其他类继承于该类。打印一组老板、销售员、工人的工资信息。
1雇员类:Employee
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Salary
{
class Employee
{
private int salary;
public Employee(int salary) {
this.salary = salary;
}
public Employee()
{
}
public int Salary {
get { return salary; }
set { salary = value; }
}
}
}
2老板类Boss
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Salary
{
class Boss:Employee
{
public Boss()
{
}
public void BossSalary()
{
Console.WriteLine("老板的工资是:");