c++ - 错误:在继承中使用已删除的函数
问题描述
我正在努力学习继承。我写了代码,在用 gcc6.3.0 编译时遇到了以下我从未见过的错误
class Book{
public:
string title;
string author;
int page;
Book(string Title, string Author, int Page){
title = Title;
author = Author;
page= Page;
}
void setAuthor(string Author){
author = Author;
}
string getAuthor(){
return author;
}
string toString(){
cout << "Title: " << title << "\nAuthor: " << author << "\nPage: " << page << endl;
}
};
class SpecialEdtionBook : public Book{
public:
void Special(){
cout << "Special editions is out"<< endl;
}
};
错误:test1.cpp:在函数“int main()”中:test1.cpp:47:23:错误:使用已删除的函数“SpecialEdtionBook::SpecialEdtionBook()”SpecialEdtionBook book2;
这个错误是什么意思?发生此类错误时我应该寻找什么?
解决方案
推荐阅读
- qualtrics - 读取以数字开头的嵌入数据?
- google-apps-script - Google 表格中的标签之间的 2-Way 同步
- javascript - 字符编码 O'
- php - 如何在变量函数PHP中显示字符串
- python - 当我在 Python 中使用命令时,命令的运行与预期不同
- java - 如何确定几个值之一是否位于 Java 的数组中?
- sql - SET NOCOUNT ON 不能在 APS 上的 SQL Server 上工作
- macos - Chrome Dev Tools Mac - 控制台日志消息未显示
- javascript - IP 范围的键值存储
- css - @font-face 不适用于具有正确格式、生成和目录路径的 CSS