[Solved] How to do inheritance [duplicate]


result of new should be assigned to a pointer

ExtendedElement *extendedElement = new ExtendedElement();

elements should be a vector of pointers

class Wrapper {
private:
    std::vector<Element*> elements;

public:
    void execute() {
        for (Element *element : elements) {
            element->execute();
        }
    }

    void addTask(Element *element) {
        elements.push_back(element);
    }
};

0

solved How to do inheritance [duplicate]