Skip to content

Instantly share code, notes, and snippets.

@cakekindel
Created August 2, 2020 19:21
Show Gist options
  • Save cakekindel/77c807a55c1ef9874ba687f61d6c208e to your computer and use it in GitHub Desktop.
Save cakekindel/77c807a55c1ef9874ba687f61d6c208e to your computer and use it in GitHub Desktop.
abstract class Coin
{
public float GetValue()
{
return this switch
{
Penny => 0.01,
Nickel => 0.05,
Dime => 0.10,
Quarter => 0.25,
};
}
}
class Penny : Coin {}
class Nickel : Coin {}
class Dime : Coin {}
class Quarter : Coin {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment