日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
事例講述VisualStudioEmployee類

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

#t#為Visual Studio Employee類添加一個(gè)CalculatePay抽象方法,該方法返回一個(gè)十進(jìn)制數(shù)。在Visual Studio Employee類的標(biāo)題打開(kāi)其快捷菜單,選擇“添加”子菜單和“方法”菜單命令,為新方法命名為“CalculatePay”。在“類詳細(xì)信息”窗口設(shè)置十進(jìn)制數(shù)作為返回類型。該方法應(yīng)該設(shè)置為抽象的。打開(kāi)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)打開(kā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ù)。

 
 
  1. public interface Iemployee
  2. {
  3. int Age
  4. {
  5. get;
  6. set;
  7. }
  8. Name Fullname
  9. {
  10. get;
  11. set;
  12. }
  13. string EmployeeInfo();
  14. }
  15. public struct Name
  16. {
  17. public string FirstName
  18. {
  19. get
  20. {
  21. throw new System.NotImplementedException();
  22. }
  23. set
  24. {
  25. }
  26. }
  27. public string LastName
  28. {
  29. get
  30. {
  31. throw new System.NotImplementedException();
  32. }
  33. set
  34. {
  35. }
  36. }
  37. }
  38. public abstract class Employee : IEmployee
  39. {
  40. #region IEmployee Members
  41. public int Age
  42. {
  43. get
  44. {
  45. throw new Exception(
  46. "The method or operation is not implemented.");
  47. }
  48. set
  49. {
  50. throw new Exception(
  51. "The method or operation is not implemented.");
  52. }
  53. }
  54. public Name Fullname
  55. {
  56. get
  57. {
  58. throw new Exception(
  59. "The method or operation is not implemented.");
  60. }
  61. set
  62. {
  63. throw new Exception(
  64. "The method or operation is not implemented.");
  65. }
  66. }
  67. public string EmployeeInfo()
  68. {
  69. throw new Exception(
  70. "The method or operation is not implemented.");
  71. }
  72. #endregion
  73. public abstract decimal CalculatePay();
  74. }
  75. public class HourlyEmployee : Employee
  76. {
  77. public decimal HourlyRate
  78. {
  79. get
  80. {
  81. throw new System.NotImplementedException();
  82. }
  83. set
  84. {
  85. }
  86. }
  87. public override decimal CalculatePay()
  88. {
  89. throw new Exception(
  90. "The method or operation is not implemented.");
  91. }
  92. public void Pay(decimal Hours)
  93. {
  94. throw new System.NotImplementedException();
  95. }
  96. }

本文標(biāo)題:事例講述VisualStudioEmployee類
文章URL:http://www.5511xx.com/article/ccohiso.html