好吧,所以我必须创建一个名为book的类,它必须具有作者,标题和日期,并且必须在末尾添加一个名为display的方法)输出标题和作者。我认为我有正确的代码,但它一直给我一个错误的日期?我在创建c类书籍时遇到了问题#
namespace lab7_feador
{
class Program
{
static void Book(string[] args);
public class Book
{
public string Nick { get; set; }
public string James { get; set; }
public string Radar { get; set; }
public int 1989 { get; set; }
}
}
}
这是它应该如何?
或像不像这个,我只需要添加日期
命名空间lab7_feador {
class Program
{
static void Main(string[] args)
{
book;
book = title book ("Radars adventure");
Console.WriteLine(book.title());
book = Author ("Nick James");
Console.WriteLine(author.Describe());
Console.ReadLine();
}
}
class book
{
private string title;
public book(string title)
{
this.title = title;
}
public string Describe()
{
return "The name of this book is " + title;
}
public string Color
{
get { return title; }
set { title = value; }
}
}
}
这是什么日期,错误信息是什么? – 2014-12-06 20:08:42
'public int 1989 {get;组; }'?哦,男孩...... – LarsTech 2014-12-06 20:09:49
将来,请始终在您的问题中包含错误消息......简单地告诉我们存在错误没有帮助。 – 2014-12-06 20:10:22