I have been using a dynamic array but I had to add and remove items. I've read it's not recommended to use realloc or to resize the arrays when one can simply use std::vector however I'm having problems in changing my array to a vector.
This is my current code:
int main(){
    // This is what I'm doing now
    State*arr[3];
    int pos = 0;
    arr[0] = new Menu();
    // How do I change it to a vector? This is what I'm trying:
    std::vector<State> vec;
    vec.push_back(Menu());
    ...
}
However I keep getting error: "Cannot allocate an object of abstract type 'State'" What am I doing wrong?
These are class State and Menu:
class State
{
public:
    virtual ~State() {};
    virtual void capture_events() = 0;
    virtual void logic() = 0;
    virtual void render() = 0;
};
Menu : public State
{
public:
    Menu();
    ~Menu();
    void capture_events();
    void logic();
    void render();
};
 
     
     
    