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); } }
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库刘秋香 c#第八章实验报告(2)在线全文阅读。
相关推荐: