这个问题参考stackoverflow有较好的解释。

https://stackoverflow.com/questions/23647409/error-base-class-constructor-must-explicitly-initialize-parent-class-construct

Now a custom constructor with two arguments are supplied for the base class constructor, therefore there is no default constructor for the base class. When inside the main function, a derived class object novel is created, at first the compiler will attempt to invoke the base class constructor which does not exist. So, the base class constructor needs to be explicitly called from the derived class constructor to initialize any private variables that the derived class has inherited from the base class but can not access directly (e.g. title string variable). 

翻译一下:

现在为基类构造函数提供了一个带有两个参数的自定义构造函数,因此基类没有默认构造函数。当在主函数内部创建派生类对象时,首先编译器将尝试调用不存在的基类构造函数。因此,基类的构造函数需要从派生类的构造函数中显式调用,以初始化派生类从基类继承但不能直接访问的任何私有变量(例如title字符串变量)。

#include <iostream>
using namespace std;

class Base {

    private:
        int x;
        int y;

    public:
        Base(int x, int y) {
            this->x = x;
            this->y = y;
        }

        int getX() {
            return x;
        }

        int getY() {
            return y;
        }

};

class Sub : public Base {

    private:
        int z;

    public:
        Sub(int x, int y, int z):Base(x, y)  {
            // write your code here
            this->z = z;
        }

        int getZ() {
            return z;
        }

        int calculate() {
            return Base::getX() * Base::getY() * this->getZ();
        }

};

int main() {

    int x, y, z;
    cin >> x;
    cin >> y;
    cin >> z;
    Sub sub(x, y, z);
    cout << sub.calculate() << endl;
    
    return 0;
}