Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the Visual Studio Employee class

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to use the Visual Studio Employee class. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

When learning Visual Studio, you may encounter Visual Studio Employee class problems, the derived type of Visual Studio Employee class must have the calculation of salary operation, here will introduce the solution to the Visual Studio Employee class problem, here to share with you.

Describe the Visual Studio ExchangeRate class

Four minutes to understand Visual Studio tools

Discuss several skills of Visual Studio class designer

The latest battle situation of Visual Studio Shell

Easily add Visual Studio class diagrams

Add a CalculatePay abstract method to the Visual Studio Employee class that returns a decimal number. Open its shortcut menu in the title of the Visual Studio Employee class, select the add submenu and the method menu command, and name the new method "CalculatePay". Set the decimal number as the return type in the Class details window. The method should be set to abstract. Open the shortcut menu of the CalculatePay method and change the inheritance modifier to abstract (abstract). Then the system displays a message box asking you to confirm the change and select "OK".

The Hourly Employee class should inherit the Visual Studio Employee class. This relationship is created with inheritance lines by dragging them from the Hourly Employee class to the Visual Studio Employee class.

* add a Pay method to the Hourly Employee class. The Pay method has only one parameter, the number of working hours. In the Class details window, expand the line of the Pay method to open the add Parameter item, select the add Parameter line and enter "Hours" as the parameter name, and modify the type to decimal. Add a HourlyRate attribute to the class to make it complete, which is also of decimal number type.

The following code is created by the class diagram. The functions you create are rough, and then you only need to implement these rough functions.

Public interface Iemployee {int Age {get; set;} Name Fullname {get; set;} string EmployeeInfo ();} public struct Name {public string FirstName {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 {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 ();}} this is the end of the article on "how to use the Visual Studio Employee class". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report