Last active
May 30, 2018 13:59
-
-
Save bijancn/36c4f7ab1ffd5aad9a47dcfa5b0dbda6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Cafe { | |
def buyCoffee(creditCard: CreditCard): (Coffee, Charge) = { | |
val cup = new Coffee() // new coffee is created | |
(cup, Charge(creditCart, cup.price)) // cup and charge is returned | |
} | |
} | |
// Can be created without new keyword | |
case class Charge(creditCard: CreditCard, amount: Double) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment