#include <iostream>
#include <vector>
#include <functional>

class Base {
    std::string data;
protected:    
    std::vector< std::function<void()> > steps;
public:
    Base() : data("qq")
    , steps{
        [](){ std::cout << "BaseMethod1()" << std::endl; }
        , [](){ std::cout << "BaseMethod2()" << std::endl; }
        , [](){ std::cout << "BaseMethod3()" << std::endl; }
        , [this](){ std::cout << "data: " << data << std::endl; }
    }
    { }
};

struct A final : Base {
    A() {
        steps.insert(
            steps.begin() + 2,
            [](){ std::cout << "A_Specific_Operations()" << std::endl; }
        );
    }
    
    void doSomething() {
        for( auto&& step : steps ) step();
    }
};

struct B final : Base {
    B() {
        steps.insert(
            steps.begin() + 1,
            [](){ std::cout << "B_Specific_Operations()" << std::endl; }
        );
    }
    
    void doSomething() {
        for( auto&& step : steps ) step();
    }
};


int main() {
    
    using namespace std;
    
    A().doSomething();
    cout << endl;
    B().doSomething();
    
}