#include "Header.h"
std::shared_ptr<Base> getPtr(char c)
{
if (c == 'c') return std::make_shared<Voice>();
else if (c == 'a') return std::make_shared<Data>();
}
class Assortment: public Base
{
public:
Assortment() = default;
~Assortment() = default;
void read(std::istream&);
void print(std::ostream&);
std::vector<std::shared_ptr<Base>> TarifList;
private:
};
void Assortment::read(std::istream& in)
{
while (!in.eof())
{
char c;
in >> c;
std::shared_ptr<Base> ptr = getPtr(c);
ptr->read(in);
TarifList.push_back(ptr);
}
}
void Assortment::print(std::ostream& out)
{
std::ostream_iterator<std::shared_ptr<Base>> _out(out);
std::copy(TarifList.begin(), TarifList.end(), _out);
}
Данный код вызывает ошибку:
Ошибка LNK2019 ссылка на неразрешенный внешний символ "class std::basic_ostream<char,struct std::char_traits > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits &,class std::shared_ptr)" (??6@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AEAV01@V?$shared_ptr@VBase@@@1@@Z) в функции "public: class std::ostream_iterator<class std::shared_ptr,char,struct std::char_traits > & __cdecl std::ostream_iterator<class std::shared_ptr,char,struct std::char_traits >::operator=(class std::shared_ptr const &)" (??4?$ostream_iterator@V?$shared_ptr@VBase@@@std@@DU?$char_traits@D@2@@std@@QEAAAEAV01@AEBV?$shared_ptr@VBase@@@1@@Z). ConsoleApplication3 C:\Users\Fedor\Desktop\VisualStudio\ConsoleApplication3\ConsoleApplication3\ConsoleApplication3.obj 1