using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;namespace CSharpConsole
{
class Product
{
public string Name { get;private set;}
public decimal Price { get;private set;}
public Product(string name, decimal price)
{
Price = price;
Name = name;
}
Product()
{
}
public override string ToString()
{
return string.Format("{0},{1}",Name,Price);
}
} class Program
{
static void Main(string[] args)
{
}
}
}
错误 1 “CSharpConsole.Product.Name.get”必须声明主体,因为它未标记为 abstract 或 extern 我是按照书上一步一步打代码的,出现了错误,不知道什么原因.我也想申明Name的主题,但是书上的例子就是这样的阿,很奇怪,难道是书上错了??
using System.Collections.Generic;
using System.Text;
using System.Collections;namespace CSharpConsole
{
class Product
{
public string Name { get;private set;}
public decimal Price { get;private set;}
public Product(string name, decimal price)
{
Price = price;
Name = name;
}
Product()
{
}
public override string ToString()
{
return string.Format("{0},{1}",Name,Price);
}
} class Program
{
static void Main(string[] args)
{
}
}
}
错误 1 “CSharpConsole.Product.Name.get”必须声明主体,因为它未标记为 abstract 或 extern 我是按照书上一步一步打代码的,出现了错误,不知道什么原因.我也想申明Name的主题,但是书上的例子就是这样的阿,很奇怪,难道是书上错了??
有些书里的代码不一定全正确 我也看书写过代码 有的确实代码错了