Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class OrderReport
def initialize(customer:, total:)
@customer = customer
@total = total
end
end
class Invoice < OrderReport
def print_out
puts "Invoice"
puts @customer
puts @total
end
end
class BillOfLading < OrderReport
def initialize(address:, **args)
super(**args)
@address = address
end
def print_out
puts "BOL"
puts @customer
puts "Shiping Label..."
puts @address
end
end
invoice = Invoice.new(customer: "Google", total: 100)
bill_of_lading = BillOfLading.new(customer: "Yahoo", total: 200, address: "123 Any Street")
invoice.print_out
bill_of_lading.print_out
# Invoice
# Google
# 100
# BOL
# Yahoo
# Shiping Label...
# 123 Any Street
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment