黑马程序员技术交流社区

标题: 修改一下结构,使之包含一个返回订单总价格的函数 [打印本页]

作者: 王锋华    时间: 2012-9-15 09:13
标题: 修改一下结构,使之包含一个返回订单总价格的函数
本帖最后由 王锋华 于 2012-9-15 14:52 编辑

    struct order
    {
     public string itemName;
    public  int      unitCount;
    public   double  unitCost;
    }
作者: iamheima    时间: 2012-9-15 10:21
  1. struct Order
  2.     {
  3.         public string itemName;
  4.         public int unitCount;
  5.         public double unitCost;

  6.         public double returnTotalPrice()
  7.         {
  8.             return unitCost * unitCount;
  9.         }
  10.     }
复制代码





欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2