class Coffee0 constructor: (name, strength = 1) -> @name = name @strength = strength class Coffee constructor: (@name, @strength = 1) -> brew: -> alert "brewing #{@name}" pour: (amount = 1) -> if amount is 1 "Poured a single cup" else "Poured #{amount} cups" french = new Coffee("French", 2) french.brew() alert(french.pour()) alert(french.pour(2)) class MaxgoodHouse extends Coffee # Cannot use @param format, because of the required call to super in Coffee 2.x. constructor: (name, strength = 0) -> super name, strength @name = name @strength = strength @brand = "Maxgood House" pour: (amount = 1) -> "#{super(amount)}, but it sucks" boring = new MaxgoodHouse("Boring") boring.brew() alert(boring.pour()) class JCoffee constructor: (@name, @strength = 1, @inventory = 0) -> pourClick: -> $("#pour-#{@name}").click (event) => if @inventory != 0 @inventory-- alert "Poured a cup of #{@name}" else alert "Out of #{@name}" j = new JCoffee "French", 2, 1 j.pourClick() class SelectFlights constructor(@fetchingFlights = null) -> $("#tabs ul li a").bind click: @changeTab $("#tabs #error a").click (event) => event.preventDefault() @showFlights $("#tabs li a.active").attr("href") showFlights: (activeDiv) -> {} changeTab: (event) => {}