iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 12
0
import Foundation;

@objc class Book : PoolItem {
    let author:String;
    let title:String;
    let stockNumber:Int;
    var reader:String?
    var checkoutCount = 0;
    
    init(author:String, title:String, stock:Int) {
        self.author = author;
        self.title = title;
        self.stockNumber = stock;
    }
    
    var canReuse:Bool {
        get {
            let reusable = checkoutCount < 5
            if (!reusable) {
                println("Eject: Book#\(self.stockNumber)");
            }
            return reusable;
        }
    }
}

上一篇
Day11:
下一篇
Day: 13 Chapter 09 TODO
系列文
Pro Design Patterns in Swift517
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言