Created
August 2, 2020 19:21
-
-
Save cakekindel/77c807a55c1ef9874ba687f61d6c208e 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
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