本文共 526 字,大约阅读时间需要 1 分钟。
#include <iostream>
#include <string>using namespace std;class Book
{ public:Book(string na, string au, int page, float price):name(na),author(au),page(page),price(price){ cout<<"书名:"<<name<<endl<<"作者:"<<author<<endl<<"页数:"<<page<<endl<<"价格:"<<price<<endl;}Book(string na, string au): name(na),author(au){ cout<<"书名:"<< <<"作者:"< <
};
int main()
{ Book b1("sa","zero",12,34);Book b2("sa","zero");Book b3; return 0;}转载于:https://blog.51cto.com/13615683/2096239