Object-oriented programming is a paradigm based on encapsulating logic and data into objects, which may then contain fields and procedures. Many widely-used programming languages support OOP, making it an important concept in modern programming. Design patterns are formalized best practices that the programmer can use to solve common problems when creating an application or system, which can speed up the development process by providing tested and proven development paradigms.
In a language that supports the OOP paradigm, we have the following code that serializes the content of a shopping cart to JSON format:
class ShoppingCart private content : Dictionary<Int, String> public function serialize() : String return new JsonSerializer().serialize(content.clone()) end function end class class JsonSerializer public function serialize(value : Dictionary<Int, String>) : String // Code that serializes dictionary to JSON format and returns it as string end function end class
A client wants to allow loosely coupled plugins to be able to serialize the shopping cart content to their own formats (e.g., XML). Select lines of code that, together, would extend the code above to allow this.
(Select all acceptable answers.)