以下是一个简单的图书管理系统的程序示例,其中包含了题目中所述的所有内容。
``` #include #include
using namespace std;
// 基类 Book class Book { public: // 构造函数 Book(string title, string author, int pages) : title(title), author(author), pages(pages) {}
// 析构函数
~Book() {}
// 复制构造函数
Book(const Book& other)
: title(other.title), author(other.author), pages(other.pages) {}
// 友元函数,用于输出书籍信息
friend ostream& operator<<(ostream& os, const Book& b);
// 静态函数,用于统计图书总数
static