好吧,所以我必須創建一個名爲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