Created
November 8, 2012 21:41
-
-
Save epalm/4041872 to your computer and use it in GitHub Desktop.
inheritance=no, interfaces=no
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
class CokeBottle | |
{ | |
public decimal Volume { get; set; } | |
public CokeBottle() | |
{ | |
Volume = 355; // mL | |
} | |
public void Gulp() | |
{ | |
Volume = Volume - 40; | |
} | |
} | |
class WaterBottle | |
{ | |
public decimal Volume { get; set; } | |
public WaterBottle() | |
{ | |
Volume = 750; // mL | |
} | |
public void Gulp() | |
{ | |
Volume = Volume - 40; | |
} | |
} | |
class Person | |
{ | |
public void DrinkWater(WaterBottle beverage) | |
{ | |
beverage.Gulp(); | |
} | |
public void DrinkCoke(CokeBottle beverage) | |
{ | |
beverage.Gulp(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment