Hire.hで私は2つのtypedefを宣言しました。 Customer.hで私はこのtypedefを使用することができます。それを修正するには?。別のクラスエラー:型が宣言されていません
#pragma once
#include "typedefs.h"
#include "Vehicle.h"
#include "Customer.h"
namespace rent {
typedef std::shared_ptr<Hire> shared_Hire_t;
typedef std::map<uuid_t, shared_Hire_t> mapHirePtr_t;
class Hire
{
public:
Hire(date_t start_date, Vehicle *vehicle, Customer *customer);
virtual ~Hire();
private:
uuid_t uuid;
date_t start_date;
date_t end_date;
uint_t hire_days;
double day_price;
double cost;
Vehicle *vehicle;
Customer *customer;
};
}
-
#pragma once
#include <iostream>
#include <map>
#include <memory>
#include "typedefs.h" //uint_t, uuid_t
#include "CustomerType.h"
namespace rent {
class Hire;
class Customer
{
public:
enum EnumCustomerType {standard, medium, premium}; //to set a CustomerType
Customer(std::string name, std::string surname, std::string pesel, double balance = 0.0, EnumCustomerType enum_customer_type = standard);
virtual ~Customer();
void add_hire(shared_Hire_t hire);
void end_hire(shared_Hire_t hire);
protected:
std::string name;
std::string surname;
std::string pesel;
double balance;
EnumCustomerType enum_customer_type;
double discount;
mapHirePtr_t current_hires;
uint_t hires_count;
private:
std::unique_ptr<CustomerType> customer_type;
};
}
-
Customer.h:31:17: error: 'shared_Hire_t' has not been declared void add_hire(shared_Hire_t hire); ^Customer.h:32:31: error: 'shared_Hire_t' has not been declared void end_hire(shared_Hire_t hire); ^Customer.h:42:3: error: 'mapHirePtr_t' does not name a type mapHirePtr_t current_hires;
^Customer.cpp:87:14: error: prototype for 'void rent::Customer::add_hire(rent::shared_Hire_t)' does not match any in class 'rent::Customer' void Customer::add_hire(shared_Hire_t hire) ^In file included from Customer.cpp:1:0: Customer.h:31:8: error: candidate is: void rent::Customer::add_hire(int) void add_hire(shared_Hire_t hire); ^Customer.cpp:94:14: error: prototype for 'void rent::Customer::end_hire(rent::shared_Hire_t)' does not match any in class 'rent::Customer' void Customer::end_hire(shared_Hire_t hire) ^Customer.cpp:1:0: Customer.h:32:22: error: candidate is: void rent::Customer::end_hire(int) void end_hire(shared_Hire_t hire);
PS。どのようにstackoverflowで適切な方法でコードの2つのブロックを分離するには?
私は、そのコードのすべてではないが、エラーを再現することが適切であるかなり確信しています。 [MCVE]を提供してください。 –