Created
September 5, 2014 21:25
-
-
Save renaudbedard/fb3385384468fdd19d3e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public interface IEdible | |
{ | |
void Eat(); | |
} | |
public interface IOrganic | |
{ | |
void ApplyDubiousHealthBenefits(Body a); | |
} | |
public class PriceyApple : IEdible, IOrganic | |
{ | |
public void Eat() | |
{ | |
// chomp | |
} | |
public void ApplyDubiousHealthBenefits(Body a) | |
{ | |
// a.omega3 += 5 | |
} | |
} | |
public static class Market | |
{ | |
List<IEdible> sales = new List<IEdible>(); | |
float moneyMade; | |
public static void Buy(IEdible a) | |
{ | |
sales.Add(a); | |
if (a instanceof IOrganic) | |
moneyMade += 10; | |
else | |
moneyMade += 5; | |
} | |
} | |
public static class Program | |
{ | |
public static void Main() | |
{ | |
PriceyApple apple = new PriceyApple(); | |
Market.Buy(a); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment