Подскажите , пожалуйста, как устранить ошибку, которую выдает VS

table.h

#pragma once
#include <iostream>
#include <string>
using namespace std;
class table
{
protected:
    double price;
    bool presense = true;
public:
    double getPrice();
    
    virtual double add_dish() = 0;
    virtual ~table() = default;
    void setPresense(bool v);
};

table.cpp

#include "table.h"

double table::getPrice()
{
    return price;
}

void table::setPresense(bool v)
{
    presense = v;
}

dish.h

#pragma once
#include "table.h"
using namespace std;
class dish:public table
{
protected:
    table* ptr = nullptr;
public:
    double add_dish()override;
    
    dish(table* _ptr);
    ~dish();
};

dish.cpp

#include "dish.h"

double dish::add_dish()
{
    return price;
}



dish::dish(table* _ptr)
{
    ptr = _ptr;
    
}

dish::~dish()
{
    delete[] ptr;
}

order.h

#pragma once
#include "table.h"
using namespace std;
class order:public table
{
public:
     double add_dish()override;
    
};

order.cpp

#include "order.h"

double order::add_dish()
{
    return 0;
}


coffee.h

#pragma once
#include "dish.h"
using namespace std;
class coffee:public dish
{
    bool presense = true;
    double price = 1.5;
public:
     double add_dish()override;
    coffee(table* v);
};

coffee.cpp

#include "coffee.h"

double coffee::add_dish()
{
    if (presense == false)
    {
        cout << "Stop list" << endl;
        return ptr->add_dish() + 0;
    }
    cout << "Coffe "<<price << endl;
    return ptr->add_dish()+price;
}

double coffee::dell_dish()
{
    return ptr->dell_dish() ;
}

coffee::coffee(table* v):dish(v)
{
}

latte.h

#pragma once
#include "dish.h"
using namespace std;
class latte:public dish
{
    bool presense = true;
    
    double price = 1.2;
public:
   double add_dish()override;
    latte(table* v);
};

latte.cpp

#include "latte.h"

double latte::add_dish()
{
    if (presense == false)
    {
        cout << "Stop list" << endl;
        return ptr->add_dish() + 0;
    }
    cout << "Latte "<<price << endl;
    return ptr->add_dish() + price;
}
latte::latte(table* v):dish(v)
{
}

discount.h

#pragma once
#include "dish.h"
class discount :public dish
{
    const bool presense = true;

    double price =0.9;
public:
     double add_dish()override;
    discount(table* v);
};

discount.cpp

#include "discount.h"

double discount::add_dish()
{
    if (presense == false)
    {
        cout << "Stop list" << endl;
        return ptr->add_dish() + 0;
    }

    return ptr->add_dish() *price;
}



discount::discount(table* v) :dish(v)
{}

user.h

#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include "table.h"
#include "latte.h" //классы из паттерна "Декоратор"
#include "coffee.h"
#include "dish.h"
#include "order.h"
#include "discount.h"
#include <iostream>
#include <string>
#include<windows.h>
#include <ctime>
#include <fstream>
#include <vector>


using namespace std;

class user
{
protected:
    int right=0; //право, которое отвечает за определенные возможности персонала
    double salary;//заработанная сумма за смену  
    int id;
    string name;
    string surname;
    string patronymic;
    tm working;
public:


    user();
    void print_u();
    void new_table(vector <table*> &t);
    void setRight(int v);
    void setSalary(double v);
    void setId(int v);
    int getId()const;
    int getRight()const;
    double getSalary()const;
    void setName(string v);
    void setSurname(string v);
    void setPatroymic(string v);
    string getName()const;
    string getSurname()const;
    string getPatronymic()const;
    void open_shift();
    void close_shift();
    virtual ~user() = default;
    virtual void add_order() = 0;
    
};

user.cpp

#include "user.h"


user::user()
{
    name = "nothing";
    right = 0;
    salary = 0;
}

void user::print_u()
{
    cout << "Name: " << name << endl;
    cout << "Surname: " << surname << endl;
    cout << "Patronymic: " << patronymic << endl;
    cout << "ID: " << id << endl;
}
void user::new_table(vector<table*> &t)
{

    t.push_back(new order());
    int code=-1;
    int i = 0;
    while (code != 0)
    {
        cout << "Enter the code of dish -> ";
        cin >> code;
        if (code == 1)
        {
            t.push_back(new latte(t[i]));
            
            i++;
        }
        if (code == 2)
        {
            t.push_back(new coffee(t[i]));
            i++;
            
            
        }
        if (code ==3)
        {
            t.push_back(new discount(t[i]));
            i++;
        }
    }
}
void user::setRight(int v)
{
    right = v;
}

void user::setSalary(double v)
{
    salary = v;
}

void user::setId(int v)
{
    id = v;
}

int user::getId() const
{
    return id;
}

int user::getRight() const
{
    return right;
}

double user::getSalary() const
{
    return salary;
}

void user::setName(string v)
{
    name = v;
}

void user::setSurname(string v)
{
    surname = v;
}

void user::setPatroymic(string v)
{
    patronymic = v;
}

string user::getName() const
{
    return name;
}

string user::getSurname() const
{
    return surname;
}

string user::getPatronymic() const
{
    return patronymic;
}

void user::open_shift()
{
    time_t rawtime;
    struct tm* timeinfo;
    time(&rawtime);
    timeinfo = localtime(&rawtime);

    working.tm_sec = timeinfo->tm_sec;
    working.tm_min = timeinfo->tm_min;
    working.tm_hour = timeinfo->tm_hour;

}

void user::close_shift()
{
    time_t rawtime;
    struct tm* timeinfo;
    time(&rawtime);
    timeinfo = localtime(&rawtime);
    string buf;
    buf = surname + " " + name + " " + patronymic + ".txt";
    fstream fs;
    string h;
    double s = 0;
    fs.open(buf, ios::in);
    while (!fs.eof())
    {
        getline(fs, h);

        s = atof(h.c_str());
        cout << s << endl;
        cout << h << endl;
    }
    fs.close();
    fs.open(buf, ios::out);
    working.tm_sec = timeinfo->tm_sec - working.tm_sec;
    working.tm_min = timeinfo->tm_min - working.tm_min;
    working.tm_hour = timeinfo->tm_hour - working.tm_hour;
    if (working.tm_sec < 0)
    {
        working.tm_min--;
        working.tm_sec = 60 + working.tm_sec;


    }
    if (working.tm_min < 0)
    {
        working.tm_hour--;
        working.tm_min = 60 + working.tm_min;
    }
    if (working.tm_hour > 14)
    {
        working.tm_sec = 0;
        working.tm_min = 0;
        working.tm_hour = 0;
    }
    
    s= s +salary * (working.tm_sec + working.tm_min * 60 + working.tm_hour * 3600);
    cout << s;
    fs << s;
    fs.close();
}

waiter.h

#pragma once
#include "user.h"
class waiter:public user
{
  public:
     waiter();
     
     void add_order() override;
    
};

waiter.cpp

#include "waiter.h"

waiter::waiter(): user()
{
    right = 2;
}



void waiter::add_order()
{
    cout << " ";
}

Source

#include "user.h"
#include "waiter.h"

using namespace std;
int main()
{
    waiter a;
    vector <table*> tables;
    a.new_table(tables);
    cout << tables[tables.size() - 1]->add_dish();
}

Скажите, пожалуйста, что мне нужно исправить, чтоб убрать ошибку: error LNK2019: unresolved external symbol "public: void __thiscall user::new_table(class std::vector<class table *,class std::allocator<class table *> > &)" (?new_table@user@@QAEXAAV?$vector@PAVtable@@V?$allocator@PAVtable@@@std@@@std@@@Z) referenced in function _main; Буду очень сильно благодарен, если поможете) И не закрывайте, пожалуйста, мой вопрос!


Ответы (0 шт):