What is the difference between abstraction and encapsulation? Define both terms and then discuss the difference. Provide examples to support your definitions and discussion.
Encapsulation hides data, sealing it away from external use. This helps with loose coupling. It prevents data from "bleeding" from one part of the application into others, or being accessible in places it should not.
Abstraction defines what features a class provides and what services it can perform. Abstractions hide away how the code functions, so the programmer is only concerned with the results. If abstractions are used properly, the entire foundational data structure can be changed without affecting code relying on that class.