using System;
using System.Collections.Generic;
using System.Text;
namespace WindowsApplication12
{
public class StudentBookSale : BookSale
{
static decimal decDiscountTotal;
const decimal decDISCOUNT_RATE = 0.15M;
public StudentBookSale(string strTitle, int intQuantity, decimal decPrice)
: base(strTitle, intQuantity, decPrice)
{
}
public static decimal DiscountTotal
{
get
{
return decDiscountTotal ;
}
}
protected override void decimal CalculateExtendedPrice()
{
decimal decDiscount;
decDiscount = Quantity * Price * decDISCOUNT_RATE;
ExtendedPrice = Quantity * Price - decDiscount;
decDiscountTotal += decDiscount;
}
class 学生价格
{
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace WindowsApplication12
{
public class BookSale
{
protected int intQuantity;
protected decimal decPrice,decExtendedPrice;
protected string strTitle;
public BookSale(string strTitle, int intQuantity, decimal decPrice)
{
this.title = strTitle;
this.Quantity = intQuantity;
this.Price = decPrice;
CalculateExtendedPrice();
}
public string title
{
get
{
return strTitle;
}
set
{
strTitle = value;
}
}
public int Quantity
{
get
{
return intQuantity ;
}
set
{
intQuantity = value;
}
}
public decimal Price
{
get
{
return decPrice;
}
set
{
decPrice = value;
}
}
public decimal ExtendedPrice
{
get
{
return decExtendedPrice;
}
set
{
decExtendedPrice = value;
}
}
protected virtual decimal CalculateExtendedPrice()
{
decExtendedPrice = intQuantity * decPrice;
}
}
class 价格
{
}
}
我要用
protected override void decimal CalculateExtendedPrice()
{
decimal decDiscount;
decDiscount = Quantity * Price * decDISCOUNT_RATE;
ExtendedPrice = Quantity * Price - decDiscount;
decDiscountTotal += decDiscount;
}
重写
protected virtual decimal CalculateExtendedPrice()
{
decExtendedPrice = intQuantity * decPrice;
}
}
提示要返回类型,我是新手刚学类。。
(时间匆忙没上注释。)。