这段程序为什么不输出啊?
Windows 7下居然提示程序代码:
#include <iostream> #include <cstring> using namespace std; class Books { private: float Price; string Author; public: Books(float price, string author); void ShowInfo(); Books& operator =(const Books &bookname); }; Books& Books::operator = (const Books &bookname) { if (&bookname == this) return *this; else { Books temp(bookname.Price, bookname.Author); return temp; } } Books::Books(float price, string author) { Price = price; Author = author; } void Books::ShowInfo() { cout << "Book Price" << '\t' << Price << endl; cout << "Book Author" << '\t' << Author << endl; } int main() { Books APEU(67, "Bob"); APEU.ShowInfo(); return 0; }