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
// In fighting code | |
switch(classType) | |
{ | |
case WARRIOR: | |
swingSword(); | |
break; | |
case MAGE: | |
castSpell(); | |
break; | |
case THIEF: |
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
public interface CharacterClass | |
{ | |
void Attack(); | |
ArmorResponse WearArmor(armor); | |
} |
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
public class Warrior : CharacterClass | |
{ | |
void Attack() | |
{ | |
swingSword(); | |
} | |
ArmorResponse WearArmor(armor) | |
{ | |
return CAN_WEAR; |
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
public Dictionary characterDictionary = | |
new Dictionary { | |
{ WARRIOR, new Warrior() }, | |
{ MAGE, new Mage() }, | |
{ THIEF, new Thief() } | |
}; |
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
// In fighting code | |
myCharacter.Attack(); | |
// In wear armor code | |
var armorResponse = myCharacter.WearArmor(armor); |
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
public class CurrencyConverter | |
{ | |
CurrencyConverter(ICurrency destinationCurrency) | |
{ ... } | |
ICurrency Convert(ICurrency sourceCurrency, decimal amount); | |
{ ... } | |
} |
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
public interface ICurrency | |
{ | |
ConvertUsing(CurrencyConverter converter); | |
} |
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
SELECT * | |
FROM | |
orders o | |
JOIN customers c | |
ON o.customerid = c.customerid | |
WHERE | |
c.companyname = 'Around the Horn' |
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
SELECT * | |
FROM | |
orders o | |
CROSS APPLY ( | |
SELECT * FROM | |
customers c | |
WHERE | |
o.customerid = c.customerid) AS c | |
WHERE | |
c.companyname = 'Around the Horn' |
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
SELECT * | |
FROM | |
orders o | |
CROSS APPLY (SELECT * | |
FROM | |
customers c | |
WHERE | |
o.customerid = c.customerid) AS c | |
WHERE | |
c.companyname = 'Around the Horn' |