All challenges
Code AnalysisBeginner 60s

Missing virtual destructor deleted through base

What will (most likely) go wrong at runtime?
Starter code
#include <memory>

struct Base {
    ~Base() = default;
};
struct Derived : Base {
    std::unique_ptr<int[]> data = std::make_unique<int[]>(100);
};

void f() {
    std::unique_ptr<Base> p(new Derived);
}

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle