Question: why am i getting this error. 124 displayBag (bag); 125 126 cout 2 #include vector 4 using namespace std; 6 template 7 class BagInterfacet virtual
why am i getting this error.









124 displayBag (bag); 125 126 cout 2 #include vector 4 using namespace std; 6 template 7 class BagInterfacet virtual void add (T); virtual void clear; irtual BagInterface operator+(BagInterface); virtual BagInterface operator*(BagInterface); virtual BagInterface operator-(BagInterface); virtual bool contains(T) virtual int getFrequencyof (T) virtual bool remove(T); virtual bool isEmpty) virtual vector 2 #include "Bag!nterface. h" 3 #include vector 4 5 using namespace std; 7 template 8 class VectorBagpublic BagInterface 10 public: VectorBag); void add (T) void clear); ectorBag operator+(VectorBag); VectorBag operator*(VectorBag); VectorBag operator-(VectorBag); bool contains (T); int getFrequencyof (T); bool remove (T); bool isEmpty) vector toVector); int getCurrentSize(); 13 14 15 17 20 21 23 24 25 26 28 29 30 32 35 36 38 private: 39 41 42 ,; vector bag; 1 include 2 #include "VectorBag.h" 3 #include vector 4 5 using namespace std; 6 template 7 VectorBag<:vectorbag bag vector>) 12 template 13 void VectorBag<:add data bag.insert template t> 20 void VectorBag<:clear bag.clear template t bool vectorbag data for em bag. iength i if return true false remove deleted ength h bag.erase vector> VectorBag<:tovector return deleted vector> result vector(); 65 for(int i i::getFrequencyOf (T data) 76 int count-o; for(int i i::isEmpty(){ 92 93 if (bag. length ( )#0) 95 96 97 98 return true; return false; 100 101 template right) 110 VectorBag result; 112 113 form 0; 127 VectorBagT> VectorBag: : operator*(VectorBageT> right)( 128 129 130 131 132 133 134 135 136 137 138 139 140 141 result.add(right.bag.get(i)); return result; VectorBag result; form 0; 146 VectorBag VectorBag: :operator-(VectorBag right) 147 148 149 150 VectorBag result; for( i 0; 23 #include 24 #include 25 #include "VectorBag.h" 26 27 using namespace std; 28 29 template class ItemType> void displayBag(VectorBag& bag) 30 template class ItemType> void bagTester(VectorBag& bag); 31 void newopsTester) 32 33 / 34 The usual main() function 36 main() 38 VectorBagestring> bag; 39 cout VectorBag, which can hold 50 any kind of element. The elements are displayed in sorted order. 51 (This means that the ItemTypes/codes must be one for which 52 the "&1t;"operation is defined. 53 @param bag The bag to be displayed 54/ 55 template class ItemType> 56 void displayBag(VectorBag ItemType>&bag) 58 Cout bagitens#bag.toVector(); 62 int numberOfEntriesstatic_cast int(bagItems.size()); 63 sort (bagItems. begin), bagItems.end)); 64 cout bagTester function in 72 Carrano-Henry main.cpps/code>, which tests the 73 .The changes are as follows: 73 ArrayBags/class> The changes are as follows: 74 75 * Whereas the original version assumed that 76 the ArrayBags/code> contained , our 77 version allows the VectorBag to contain any kind of 78 item. 9 - In addition to testing the original operations that are 80implemented from
BagInterface, we test the operations 81 of union, intersection, and difference.1is 82
83 @param bag The bag to be tested. 84 85 templatecclass ItemType> void bagTester(VectorBag& bag) 87 cout &) projl.cpp:41:17 required from here proj 1.cpp:106 : 9: error : no match for 'operatorec' (operand types are [with ltenType std::-cxx 11: :basic-stringchar)': = std: :basic-ostreamchar. and .void ') bag.add("extra") & (*) (std:: basic-ostreamchar%)') /usr/include//8/ostream:117:7:note: candidate: 'std::basic_ostreans CharT, _Traits::_ostream type& std::basic_ostreams CharT, _Traits>::operatorss(std::basic_ ostreams CharT, _Trait s.. ios-type& (*) (std: :basic-ost ream:: ios type&)) [with-CharT char' -Traits = std: char traitschar ; std::basic ostreams_CharT, Traits:- ost rean type std::h asie_ostreanchar; std: :basic-ost ream-CharT'-Traits::os-type=std::basic-ioschar]. operatore(ios_type& (* pf)(ios_type&)) /usr/include/c++/8/ostream :117:7: note: no known conversion for argument 1 fron .void . to 'std: t basic ostreanchar:: ios-type& (*) (std: t basic-ostreamechart. 10s type&)' {aka std:t basic ios char& ()(std: basic ioscchar>&) 'h usr/include/c+H/8/ostream: 127:7: note: candidate: std::basic ostreame CharT, Traits>:ostream_type& std::basic ostreame CharT, Traits>::operatoree(std::ios base& ()(std:tios base& )) [with-CharT char;-Traits = std::chartraitschar; std: :basic-os t rean-CharT, -Traits::-ost ream-type = std:: basic-os treanchar) operatoree(ios base&pf) (ios base&)) /usr/ include/c++/8/ostream :127:7: note : no known conversion for argument 1 fron .void' to std ::ios-base& (*) (std::10s-base&) /usr/include/c++/8/ostream :166 : 7 : note: candidate : std:: basic ostrean-CharT' -Traits:.- ostream-type& std :: basic ostream(CharT, raits = std:: char-traitschar; std: :basic_cstrean]' eratore::operator] basic ostreame CharT, _Traits>:: usr/include/c+/8/bits/ostrean.tcc:91:5t note no known conversion for argunent 1 fron void' to 'short int' In file included fron /usr/include/c++/8/iostream:39, fron proj1.cpp:23 usr/include/c+H/8/ostream:181:7: note: candidate: std::basic ostream::operatoree(short unsigned int) [with_Char operatoree(unsigned shortn) usr/include/c+H/8/bits/ostrean.tcc:321:5: note: tenplate argunent deduction/substitution failed: proji.cpp:106:9: note: cannot convert & bag)-VectorBagestd::cxx11::basic stringcchar> add (std:: cxx1l::basic stringechar>(((const char)"extra"), std::allocatorechar>O))' (ty pe "void') to type const char*' e bag.add("extra") &std::operatore(std::basic ostreamcchar, Traits>&, const char*)' operator&out, const char) /usr/include/c+/8/ostream:556:5: note: template argunent deduction/substitution failed: proji.cpp:106:9: note: cannot convert & bag)-VectorBag<: cxx1l::basic_stringcchar> >::add(std::cxx11::basic_stringcchar(((const char*) "extra"), std::allocatorccharr)))' (ty pe 'void' to type const char bag.add("extra") endl; In file included fron Jusr/include/c++/8/iostream:3 fron projl.cpp: 23 /usr/include/c/8/ostream:569:5:note: candidate: 'templatesclass_Traits std::basic ostreancchar, _Traits& std::operatorse(std::basic_ostreamcchar, Traits &, const signed char) operatoree(basic_ostreanechar, Traits>&_out, const signed chars) /usr/include/c/8/ostream:569:5:note: template argunent deduction/substitution failed: projl.cpp:106:9: note: cannot convert '(& bag)-VectorBagestd: :_cxx11l::basic_ stringechar> ::add(std::_cxx11::basic stringechar((const chara)"extra"), std::allocatorechar)))(ty pe 'void') to type 'const signed char* ss bag.add("extra") std:tbasic_ostreancchar, Traits>& std:toperator&, const unsigned charx) operatoree(basic_ostreanechar, Traits>&out, const unsigned char) usr/include/c+H/8/ostream:574:5t note template argunent deduction/substitution failed: projl.cpp:106:9: note cannot convert& bag)->VectorBagestd::_ cxxll::basic stringechars >iiadd(std:: cxx11:tbasic_stringechar>((const char)"extra"),std:tallocatorechar>)))' (ty pe "void') to type 'const unsigned chars bag. add ( "extra" ) end 1 ; typename std::enable if<: and not lvalue_reference tp>,std:: is convert ible to-basic-ostrean.Ostream std:: -is-insertabletypename std.. is-convertible to basic-ostrean-Tp>::-ostream-type const -Tp& void> >::value typename std::-15-convertible to basic ostreamc Tp ostrean type>::type std::operator >, std:: is_convertible to-basic-ost reamc0stream std:: -s_insertablectypename std:: 15-convertible to-basic-ostreams_Tp>. ost ream-type, const-TpG, void> >::value e_ostreams_Tp>::ost rean-type>:: type std: :operator6; -Tp-void]' : proj1.cpp:106:9: required from 'void bagTester(VectorBagsItemType&) [with ItenType std::_cxx11::basic stringschar ]' projl.cpp:41:17: required from here usr/include/c++/B/ostream: 682:5:error: forming reference to void typename std::- IS-convertible to-basi