I'm trying to code in C++ (C++11) a very simple example according to the Clean Architecture concept described by Uncle Bob Martin here (picture below):

enter image description here

The idea is to read some text by a Controller and print it by a Presenter. I have done something but it doesn't look like it's following the clean flow and the DIP of the blog post.

Among other things, I think the flow is wrong as, for example, the IUseCaseInputPort needs to know about the IUseCaseOutputPort (the read function has the IUseCaseOutputPort as input parameter, creating thus another dependency...).

I would really appreciate if someone could give me some tips about the best way to implement this. Many thanks in advance.

#include <iostream>
#include <string>
#include <memory>

class IUseCaseOutputPort {
public:
    virtual void print(std::string message) = 0;
    virtual ~IUseCaseOutputPort() {};
};

// 2 Presenters
class HtmlPresenter: public IUseCaseOutputPort {
public:
    void print(std::string message) {
        std::cout << "<p>" << message << "</p>" << std::endl;
    }
};

class TextPresenter: public IUseCaseOutputPort {
public:
    void print(std::string message) {
        std::cout << message << std::endl;
    }
};

//
class IUseCaseInputPort {
public:
    virtual void read(std::shared_ptr<IUseCaseOutputPort> output) = 0;
    virtual ~IUseCaseInputPort(){};
};

// specific UseCaseInteractor
class UseCaseInteractorForInputFromStdIn: public IUseCaseInputPort {
public:
    void read(std::shared_ptr<IUseCaseOutputPort> output) {
        std::string message;
        std::cout << "Pl
Edit
Report