这个错误提示是因为在创建'NotificationCenter'类的对象时,'receiverModel'成员变量没有默认构造函数,需要显式地进行初始化。解决方法如下:

  1. 在'NotificationCenter'类的构造函数中初始化'receiverModel'对象。

例如:

class NotificationCenter {
public:
    NotificationCenter() : receiverModel(ReceiverModel()) {}
private:
    ReceiverModel receiverModel;
};
  1. 给'receiverModel'添加默认构造函数。

例如:

class ReceiverModel {
public:
    ReceiverModel() {}
};

以上两种方法都可以解决这个错误提示。

'NotificationCenter' 构造函数必须显式初始化成员 'receiverModel',它没有默认构造函数

原文地址: https://www.cveoy.top/t/topic/mS4w 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录