Skip to content

Instantly share code, notes, and snippets.

@Adzz
Created January 31, 2018 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Adzz/aa31e76d86efa10d9b3919a2cf1420b8 to your computer and use it in GitHub Desktop.
Save Adzz/aa31e76d86efa10d9b3919a2cf1420b8 to your computer and use it in GitHub Desktop.
defmodule Project do
def total_cost(shape = %Square{}, cost_per_square_meter) do
Square.area(shape) * cost_per_square_meter
end
def total_cost(shape = %Circle{}, cost_per_square_meter) do
Circle.area(shape) * cost_per_square_meter
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment