Wektory i polimorfizm w C ++

Mam trudną sytuację. Jego uproszczona forma to coś takiego

class Instruction
{
public:
    virtual void execute() {  }
};

class Add: public Instruction
{
private:
    int a;
    int b;
    int c;
public:
    Add(int x, int y, int z) {a=x;b=y;c=z;}
    void execute() { a = b + c;  }
};

A potem w jednej klasie robię coś takiego ...

void some_method()
{
    vector<Instruction> v;
    Instruction* i = new Add(1,2,3)
    v.push_back(*i);
}

A w kolejnej klasie ...

void some_other_method()
{
    Instruction ins = v.back();
    ins.execute();
}

I w jakiś sposób dzielą ten wektor instrukcji. Moją troską jest część, w której wykonuję funkcję „wykonaj”. Czy to zadziała? Czy zachowa swój typ Add?

questionAnswers(4)

yourAnswerToTheQuestion