C#结构函数与base关键字

时间:2021-11-02 14:40:42
 //声明父类
class ProductsFather
{
public double Price
{
get;
set;
}
public int Count
{
get;
set;
}
public string Id
{ get;
set; } //给字段赋值 c#结构函数
public ProductsFather(double price, int count, string id)
{
this.Price = price;
this.Count = count;
this.Id = id;
} }
  class Xiangjiao:ProductsFather
{
public Xiangjiao(double pirce, int count, string id)
: base(pirce, count, id)
{ }
}