Implementing the adapter design pattern in C++
This easy coding problem tests your understanding of the adapter design pattern, a structural pattern used to bridge incompatible interfaces. In real trading systems, legacy and modern components often coexist; adapters let them work together without rewriting the older code.
The question asks you to create a bridge between a standardized modern interface and a legacy FIX-message-based gateway. You'll implement the adapter via composition rather than inheritance, meaning you hold a pointer to the legacy component and delegate to it. The key skill is translating method calls from one interface contract to another—here, converting structured order data into the string format the legacy system expects.
- Composition vs. inheritance trade-offs
- Interface abstraction and virtual methods
- String formatting and data transformation
- Pointer ownership and initialization