刘秋香 c#第八章实验报告(2)

2018-11-28 16:34

Console.ReadLine(); } }

public class Book {

private string title; public string Title {

get { return title; } set {

title = value; } }

private string author; public string Author {

get { return author; } set {

author = value; } }

private double price; public double Price {

get { return price; } set {

if (value < 0) price = 0; else price = value; } }

private int count; public int Count {

get { return count; } set {

if (value < 0) count = 0; else count = value; } }

private bool sold = false; public bool Sold {

get { return sold; } set { sold = value; } }

public Book(string title, string author, double price)

{

this.title = title; this.author = author; this.price = price; }

public Book(string title, string author, int count) {

this.title = title; this.author = author; this.count = count; }

public event SaleDelegate OnSale; public void ChangeSold() {

if ((OnSale != null) && (sold == true)) OnSale(sold); } }

class BookSales {

public void sale(Book book) {

book.OnSale += new SaleDelegate(book_OnSale); }

void book_OnSale(bool sold) {

Console.WriteLine(\售出1本\, DateTime.Now); } }


刘秋香 c#第八章实验报告(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:海南省2013年中小学教师普法考试试卷

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: