标题:职工工资
只看楼主
冰封谷主
Rank: 4
等 级:贵宾
威 望:10
帖 子:226
专家分:20
注 册:2005-1-7
 问题点数:0 回复次数:0 
职工工资

using System; public class Company { protected int m=800; protected int n=300; public virtual void pay() { Console.WriteLine("The is your pay:"+m+"(yuan)!"); } } class Boss:Company { public override void pay() { Console.WriteLine("Boss,This is your pay:"+(m+2*n)+"(yuan)"); } } class Worker:Company { public override void pay() { Console.WriteLine("Worker,This is your pay!"+m); } }

class intput { static void Main() { Console.WriteLine("Input your style! \n boss or worker ?"); string c=Console.ReadLine(); if (c=="boss") { Boss b=new Boss(); b.pay(); } if(c=="worker") { Worker w =new Worker(); w.pay(); } System.Threading.Thread.Sleep(3000); } }

搜索更多相关主题的帖子: 工资 pay Boss 职工 
2005-04-05 15:19



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-14857-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.274250 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved