最初我收到一个错误,我不能在咖啡类"咖啡"中将"_coffee"命名为"_coffee",因为成员名称不能与其封闭类型相同.当我将名称更改为_coffee时,我收到一条错误"coffeeShop不包含带0参数的构造函数." 我在网上找到了解决方案,但它们似乎不适用于我的应用程序或正常工作.请帮忙.
public class coffeeShop
{
string _size;
string _type;
public coffeeShop(string size, string type)
{
_size = size;
_type = type;
}
public override string ToString()
{
return String.Format("Thanks for ordering: {0}, {1}", _size, _type);
}
}
class Coffee : coffeeShop
{
string _size;
string _type;
string _caffiene;
public virtual void _Coffee( string size, string type, string caffiene)
{
_caffiene = caffiene;
_size = size;
_type = type;
}
public override string ToString()
{
return String.Format("Product Information for: {0} …Run Code Online (Sandbox Code Playgroud) c# ×1