类
1 [assembly: CLSCompliant(true)] //属性
2 public class Furniture //类声明
3 {
4 const double salesTax = 0.065; //常量
5 private double purchPrice;
6 private string vendor, inventoryID; //字段
7
8 public Furniture(string strvendor, string strinvenID, double DubpurchPrice)
9 {
10 this.vendor = strvendor;
11 this.inventoryID = strinvenID;
12 this.purchPrice = DubpurchPrice;
13 } //构造函数
14
15 public string MyVendor{get { return vendor; }}//方法属性
16
17 public double CalcSalesTax(double salePrice) { return salePrice * salesTax; }//方法
18 }
2 public class Furniture //类声明
3 {
4 const double salesTax = 0.065; //常量
5 private double purchPrice;
6 private string vendor, inventoryID; //字段
7
8 public Furniture(string strvendor, string strinvenID, double DubpurchPrice)
9 {
10 this.vendor = strvendor;
11 this.inventoryID = strinvenID;
12 this.purchPrice = DubpurchPrice;
13 } //构造函数
14
15 public string MyVendor{get { return vendor; }}//方法属性
16
17 public double CalcSalesTax(double salePrice) { return salePrice * salesTax; }//方法
18 }