Created
April 29, 2020 04:24
-
-
Save drinkmorewaters/2441a8a4df515d7767d3fa4b410728bd to your computer and use it in GitHub Desktop.
Class with getter Crystal
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
class Cars | |
getter price : Int64 | |
getter condition : String | |
def initialize(@type : String, @price : Int64, @condition : String, @location : String, @color : String); end | |
end | |
johns_car = Cars.new "Holden", 10000, "Fair", "New York", "Red" | |
puts "Johns car is in #{johns_car.condition} condition, although, the price is cheap at only #{johns_car.price}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment