How do I separate interface and implementation cleanly for low-latency systems?

Learn how to effectively separate interface and implementation in C++ for low-latency systems to enhance performance and maintainability.
C++, low-latency systems, interface, implementation, performance, maintainability

#include 

// Interface definition
class ICalculator {
public:
    virtual int add(int a, int b) = 0;
    virtual int subtract(int a, int b) = 0;
};

// Implementation of the interface
class Calculator : public ICalculator {
public:
    int add(int a, int b) override {
        return a + b;
    }

    int subtract(int a, int b) override {
        return a - b;
    }
};

// Client code demonstrating the separation
int main() {
    ICalculator* calculator = new Calculator();
    std::cout << "Addition: " << calculator->add(5, 3) << std::endl;
    std::cout << "Subtraction: " << calculator->subtract(5, 3) << std::endl;

    delete calculator;
    return 0;
}
    

C++ low-latency systems interface implementation performance maintainability