だから私はこの倉庫クラスを持っています:
Warehouse.h:
#ifndef WAREHOUSE_H
#define WAREHOUSE_H
#include<string>
#include<map>
#include "dates.h"
namespace a4
{
class warehouse
{
public:
warehouse(std::string name, std::string start_date);
private:
std::string name;
std::string busiest_day;
int most_transactions;
std::map<std::string, a4::food> items;
dates current_date;
void next_day();
};
}
#endif
Warehouse.cc:
#include "warehouse.h"
#include "dates.h"
namespace a4
{
//constructor
warehouse::warehouse(std::string name, std::string start_date)
{
this->current_date = new dates(start_date);
}
void warehouse::next_day()
{
this->current_date.next_day();
}
}
そして、取得するコンパイラエラーは次のとおりです。
warehouse.cc: In constructor ‘a4::warehouse::warehouse(std::string, std::string)’:
warehouse.cc:8: error: ‘class a4::warehouse’ has no member named ‘current_date’
warehouse.cc: In member function ‘void a4::warehouse::next_day()’:
warehouse.cc:12: error: ‘class a4::warehouse’ has no member named ‘current_date’
current_date
なぜメンバーとして認識されないのか、何か考えはありますか?おそらくかなり簡単ですが、私はc++を学ぶのにほんの数週間しかかかりません。