C# 2.0 定义一个类,有属性,然后用display显示详细信息如题 谢谢了
定义一个图书类(Book),该类包含属性:图书名、作者、出版社名、出版社地址、出版社邮编,包含方法:display方法显示图书的信息。C#2.0的...
定义一个图书类(Book),该类包含属性:图书名、作者、出版社名、出版社地址、出版社邮编,包含方法:display方法显示图书的信息。C# 2.0的
展开
1个回答
展开全部
public class Book { private Publisher publisher; //出版社名 public Publisher Publisher { get { return publisher; } set { publisher = value; } } private string title = String.Empty; //图书名 public string Title { get { return title; } set { title = value; } } private string author; //作者 public string Author { get { return author; } set { author = value; } } private Publisher publishAddress; //出版地址 public Publisher PublishAddress { get { return publishAddress; } set { publishAddress = value; } } private Publisher publishPostcode; //出版邮编 public Publisher PublishPostcode { get { return publishPostcode; } set { publishPostcode = value; } } public void display() { Console.WriteLine("图书名:"+title); Console.WriteLine("作者:"+author); Console.WriteLine("出版社名:"+publisher); Console.WriteLine("出版社地址:"+publishAddress); Console.WriteLine("出版社邮编:"+publishPostcode); } }
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询