Last active
June 8, 2023 21:51
-
-
Save ThiagoBarradas/5ff1c67e8c83d819f174c7de8c183d78 to your computer and use it in GitHub Desktop.
SOLID [D] - Wrong implementation with high coupling
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 class CreditCard | |
{ | |
public bool Pay(int amount) | |
{ | |
// do something | |
} | |
} | |
public class Person | |
{ | |
public CreditCard CreditCard { get; set; } | |
public Person() | |
{ | |
this.CreditCard = new CreditCard(); | |
} | |
} | |
// calling | |
Person person = new Person(); | |
person.CreditCard.Pay(100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment