VisualStudioEmployee類怎么用

這篇文章將為大家詳細(xì)講解有關(guān)Visual Studio Employee類怎么用,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

為方正等地區(qū)用戶提供了全套網(wǎng)頁(yè)設(shè)計(jì)制作服務(wù),及方正網(wǎng)站建設(shè)行業(yè)解決方案。主營(yíng)業(yè)務(wù)為網(wǎng)站設(shè)計(jì)制作、網(wǎng)站設(shè)計(jì)、方正網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠(chéng)的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!

學(xué)習(xí)Visual Studio時(shí),你可能會(huì)遇到Visual Studio Employee類問(wèn)題,Visual Studio Employee類的派生類型必須具有計(jì)算薪水操作,這里將介紹Visual Studio Employee類問(wèn)題的解決方法,在這里拿出來(lái)和大家分享一下。

  • 描述Visual Studio ExchangeRate類

  • 四分鐘懂得Visual Studio工具

  • 討論Visual Studio類設(shè)計(jì)器多項(xiàng)技巧

  • Visual Studio Shell最新戰(zhàn)況

  • 輕松添加Visual Studio類關(guān)系圖

為Visual Studio Employee類添加一個(gè)CalculatePay抽象方法,該方法返回一個(gè)十進(jìn)制數(shù)。在Visual Studio Employee類的標(biāo)題打開其快捷菜單,選擇“添加”子菜單和“方法”菜單命令,為新方法命名為“CalculatePay”。在“類詳細(xì)信息”窗口設(shè)置十進(jìn)制數(shù)作為返回類型。該方法應(yīng)該設(shè)置為抽象的。打開CalculatePay方法的快捷菜單并修改“繼承修飾符”為abstract(抽象)。然后系統(tǒng)顯示一個(gè)消息框要求你對(duì)這一修改進(jìn)行確認(rèn),選“確定”。

Hourly Employee類應(yīng)該繼承Visual Studio Employee類。這一關(guān)系用繼承線來(lái)創(chuàng)建,具體做法是:將繼承線從Hourly Employee類拖到Visual Studio Employee類。

***,為Hourly Employee類添加一個(gè)Pay方法。Pay方法只有一個(gè)參數(shù),就是工作的小時(shí)數(shù)。在“類詳細(xì)信息”窗口,擴(kuò)展Pay方法的行來(lái)打開 “添加參數(shù)”項(xiàng),選擇“添加參數(shù)”行并輸入“Hours”作為參數(shù)名,修改類型為十進(jìn)制數(shù)。添加一個(gè)HourlyRate屬性到該類以使其完整,該屬性也是十進(jìn)制數(shù)類型的。

以下代碼由類關(guān)系圖創(chuàng)建。創(chuàng)建的函數(shù)是很粗略的,接下來(lái)只需要實(shí)現(xiàn)這些粗略的函數(shù)。

public interface Iemployee  {  int Age  {  get;  set;  }  Name Fullname  {  get;  set;  }  string EmployeeInfo();  }  public struct Name  {  public string FirstName  {  get  {  throw new System.NotImplementedException();  }  set  {  }  }  public string LastName  {  get  {  throw new System.NotImplementedException();  }  set  {  }  }  }  public abstract class Employee : IEmployee  {  #region IEmployee Members  public int Age  {  get  {  throw new Exception(  "The method or operation is not implemented.");  }  set  {  throw new Exception(  "The method or operation is not implemented.");  }  }  public Name Fullname  {  get  {  throw new Exception(  "The method or operation is not implemented.");  }  set  {  throw new Exception(  "The method or operation is not implemented.");  }  }  public string EmployeeInfo()  {  throw new Exception(  "The method or operation is not implemented.");  }  #endregion  public abstract decimal CalculatePay();  }  public class HourlyEmployee : Employee  {  public decimal HourlyRate  {  get  {  throw new System.NotImplementedException();  }  set  {  }  }  public override decimal CalculatePay()  {  throw new Exception(  "The method or operation is not implemented.");  }  public void Pay(decimal Hours)  {  throw new System.NotImplementedException();  }  }

關(guān)于“Visual Studio Employee類怎么用”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。

分享題目:VisualStudioEmployee類怎么用
網(wǎng)頁(yè)網(wǎng)址:http://www.muchs.cn/article0/ihpgoo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導(dǎo)航、網(wǎng)站制作、服務(wù)器托管、網(wǎng)站營(yíng)銷、手機(jī)網(wǎng)站建設(shè)、企業(yè)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

網(wǎng)站建設(shè)網(wǎng)站維護(hù)公司