Althea°木槿 2018-12-30 23:07 采纳率: 0%
浏览 754

未能找到类型或命名空间名称“Employee”(是否缺少 using 指令或程序集引用?)

using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace pby{ class Manager : employee { private double bonus; public Manager(string name, double salary, int year, int month, int day, double bonus):base(name, salary, year, month, day) { this.bonus = bonus; } public double Bonus { get { return bonus; } set { bonus = value; } } public override void Earnings() { earnings = salary + bonus; } public override string Type { get { return "经理"; } } public override void TellAboutSelf() { base.TellAboutSelf(); Console.WriteLine("基本工资:" + String.Format("{0:c}", Salary) + "\n奖金:" + String.Format("{0:c}", Bonus)); Console.WriteLine("----------------"); } } class Pieceworker : Employee { private double quantity; public Pieceworker(string name, double salary, int year, int month, int day, double quantity) : base(name, salary, year, month, day) { this.quantity = quantity; } public double Quantity { get { return quantity; } set { quantity = value; } } public override void Earnings() { earnings = Salary * quantity; } public override string Type { get { return "计件工人"; } } public override void TellAboutSelf() { base.TellAboutSelf(); Console.WriteLine("每件工资:" + String.Format("{0:c}", Salary) + "\n生产产品件数:" + String.Format("{0:n}", quantity)); Console.WriteLine("----------------"); } } partial class Timeworker : Employee { private float hoursworked; public Timeworker(string name, double salary, int year, int month, int day, float hoursworked) : base(name, salary, year, month, day) { this.hoursworked = hoursworked; } public float Hoursworked { get { return hoursworked; } set { hoursworked = value; } } } partial class Salesman : Employee { private double commission; private float rate; public Salesman(string name, double salary, int year, int month, int day, double commission, float rate) : base(name, salary, year, month, day) { this.commission = commission; this.rate = rate; } public double Commission { get { return commission; } set { commission = value; } } public float Rate { get { return rate; } set { rate = value; } } }}

  • 写回答

1条回答 默认 最新

  • threenewbee 2018-12-30 15:17
    关注

    Employee这个类没有定义,或者虽然定义了,但是命名空间不是pby,你首先找下Employee,如果没有,建立一个Employee类。如果有,检查下它的命名空间是什么,在你这里using下。
    如果还不行,检查下Employee是不是定义在某个类之下的内部类,或者class前面没有public

    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置