各位大哥周末愉快。快救救我吧,不然我要放弃C++了。

来源:百度知道 编辑:UC知道 时间:2024/09/23 04:51:39
【Goods.cpp】
#include"WriteFile.cpp"
#include<iostream>
#include<string>
#include"Date.cpp"
using namespace std;
class Date;
class GWriteFile;
class GReadFile;
class CGoods
{
friend GWriteFile;
friend GReadFile;
friend Date;
protected:
string GoodsName;
string GoodsNumber;
string GoodsType;
string GoodsSource_Address;
float GoodsInPrice;
int GoodsInAmount;
Date GoodsInDate;
public:
CGoods();
CGoods(string,string,string,string,float,int,Date);
void InputGoods();
void SaveGoods();
void OutputGoods();
};

CGoods::CGoods():GoodsName(""),GoodsNumber(""),GoodsType(""),GoodsSource_Address(""),GoodsInPrice(0),GoodsInAmount(0),GoodsInDate(Date &){}
CGoods::CGoods(string Name,string Number,string Type,string Source_Address,float InPrice,int InAmount,Date InDate)

你的文件是怎么组织的??把所有的头文件发过来看下
你又把这个date.CPP文件发上来干吗?上面不是有吗
我是要头文件

#include"WriteFile.cpp"
#include"Date.cpp"
改成
#include"WriteFile.h"
#include"Date.h"

第二个是重复定义了的。你等好了。我帮你看看
把你的头文件拿来

有这么搞法?不是包含的是头文件么
还有你把你的CGoods头文件的文件头加入
#ifdef CGoods_x
#difine CGoods_x 1
文件未加入
#endif
这样就可以解决重复定义的问题

估计你需要再看一遍基础知识,C++编程风格 这本书还可以,去看看吧