/* book.h */
#ifndef __BOOK_H__
#define __BOOK_H__
#include
using namespace std;
class book
{
public:
book();
book(string,string,unsigned,double);
book(string,string);
~book();
private:
string bookName;
string author;
unsigned page;
double price;
};
#endif//__BOOK_H__
/*-----------------------------------------*/
/* book.cpp */
#include "book.h"
book::book()
{
cout<<"对象已构造"<}
book::book(string bookName,string author,unsigned page,double price)
{
this->bookName = bookName;
this->author = author;
this->page = page;
this->price = price;
}
book::book(string bookName,string author)
{
this->bookName = bookName;
this->author =author;
}
book::~book()
{
cout<<"对象已析构"<}
/*-----------------------------------------*/
/* test.cpp */
#include "book.h"
int main()
{
book b1("语文","qwe",200,66.55);
book b2("数学","rte",100,213.1);
book b3;
return 0;
}
/*-----------------------------------------*/
恩恩,好。擅长做。。给你帮助.