Skip to content

Instantly share code, notes, and snippets.

@ThiagoBarradas
Last active May 6, 2021 06:20
Show Gist options
  • Save ThiagoBarradas/ba35f689b8158b9558e44bcdeae75a2a to your computer and use it in GitHub Desktop.
Save ThiagoBarradas/ba35f689b8158b9558e44bcdeae75a2a to your computer and use it in GitHub Desktop.
SOLID [D] - Wrong implementation with high coupling
public class CreditCard
{
public bool Pay(int amount)
{
// do something
}
}
public class Person
{
public CreditCard CreditCard { get; set; }
public Person(CreditCard creditCard)
{
this.CreditCard = creditCard;
}
}
// calling
CreditCard creditCard = new CreditCard();
Person person = new Person(creditCard);
person.CreditCard.Pay(100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment