У меня проблема с наследованием от абстрактного класса.Неопределенная ссылка на vtable (Наследование)
Абстрактный класс - файл заголовка:
#ifndef CLIENT_H
#define CLIENT_H
#include "country.h"
#include "currency.h"
#include "item.h"
#include "order.h"
#include <string>
#include <vector>
using namespace std;
class Order;
class Client {
string first_name;
string last_name;
int account_balance;
Country country;
Currency currency;
vector <Order> orders;
public:
Client (string first_name, string last_name, Country country, Currency currency);
void buy_item (Item item, unsigned quantity, unsigned order_ID);
void add_order (unsigned ID);
virtual void pay (unsigned order_ID) = 0; //
};
#endif // CLIENT_H
Абстрактный класс - .cpp файл:
#include "client.h"
Client::Client (string first_name, string last_name, Country country, Currency currency)
: first_name(first_name), last_name(last_name), country(country), currency(currency)
{
account_balance = 0;
}
Наследование класса - Заголовочный файл:
#ifndef ENGLISHCLIENT_H
#define ENGLISHCLIENT_H
#include "client.h"
#include <string>
using namespace std;
class EnglishClient : public Client {
public:
EnglishClient (string first_name, string last_name);
void pay (unsigned order_ID);
};
#endif // ENGLISHCLIENT_H
Наследование класса -. cpp-файл:
#include "englishclient.h"
EnglishClient::EnglishClient (string first_name, string last_name)
: Client(first_name, last_name, GB, GBP)
{
}
И, наконец, ошибка:
GB и GBP являются перечисляемые переменные:
enum Country {GB, PL};
enum Currency {GBP, PLN};
есть виртуальный dtor в классе Client? –