C++ Advanced, Task08_04_Word - pls help...
Здравейте, наистина още е объркващо; Незнам как да подходя към 4-та, и каква основна логика да следвам, може ли малко помощ?
Пробвах два подхода, но предполагам никой не е верен: с изведена функция, която връща shared_ptr към текста и Вариант2: клас, с оператор () който връща същото. Но в main() нищо от двете не се разпознава:
std::shared_ptr<CommandInterface> buildCommandInterface(std::string& text) {
    return std::shared_ptr<CommandInterface>{ std::make_shared<CommandInterface>(text)};
}
//struct buildCommandInterface : public CommandInterface {
//    std::string& text;
//public:
//    buildCommandInterface(std::string& text) : CommandInterface(text), text(text) {}
//    
//    std::shared_ptr<CommandInterface> operator()( std::string& text) const {
//        return std::shared_ptr<CommandInterface>{ std::make_shared<CommandInterface>(this->text) };
//    }
//
//};
Благодаря.