Created
April 14, 2016 08:18
-
-
Save krokrob/96b2ec038fc7cfa1f7ca9120684e9fe5 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
class Restaurant | |
attr_reader :name, :city | |
def initialize(name, city) | |
@name, @city = name, city | |
end | |
def welcome | |
return "Welcome to #{@name}" | |
end | |
end | |
class FastFood < Restaurant | |
attr_reader :prep_time | |
def initialize(name, city, prep_time) | |
super(name, city) | |
@prep_time = prep_time | |
end | |
def welcome | |
return "Welcome to #{@name}, here we are fast!" | |
end | |
end | |
class Gastronomic < Restaurant | |
attr_reader :stars | |
def initialize(name, city, stars) | |
@name, @city = name, city | |
@stars = stars | |
end | |
def welcome | |
puts "Here we are starred!" | |
super | |
end | |
end | |
bk = FastFood.new("Burger King", "Paris", 5) | |
bouitte = Gastronomic.new("La Bouitte", "St-Martin", 3) | |
# | |
p bk | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment