求助:无法解析的外部符号 “class std::basic_ostream...”
template <class T>
ostream & operator<< (ostream & output, const Array<T> & theArray)
{
for(int i=0; i<theArray.GetSize(); i++)
output << "[" << i << "]" << theArray[i] << endl;
return output;
}
编译链接时出现如下错误
001.obj : error LNK2019: 无法解析的外部符号 "class std::basic_ostream > & __cdecl operator<<(class std::basic_ostream > &,class Array const &)" (??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABV?$Array@VAnimal@@@@@Z) ,该符号在函数 _main 中被引用。
请指点
相关推荐
VC6.0中重载操作符友元函数无法访问类的私有成员的解决办法.docx
。
VC6.0中重载操作符友元函数无法访问类的私有成员的解决办法.pdf
。
String类的写时拷贝实例
实例如下: #include<iostream> using namespace std; class String; ostream& operator<<(ostream &out, const String&s); //引用计数器类 class String_rep { friend class String; friend ostream& operator<<(ostream &out, const String&s); public: String_rep(const char *str ) :use_count(0) { if (
C++中的模拟class string类的代码 cpp
//一个C++初学者的string类,恳请朋友们多多指点 //特殊功能:- 取负数运算符代表将字符串翻转 函数头: class string{ friend int len(string &); friend const string & operator+(const string &s1,const string &s2); friend std::ostream & operator<<(std::ostream &theStream,const string & str); friend const string & operator+(const string &s1,const char * s2); friend const string & operator+(const char * s2,const string &s1); private: int itslen; public: string(); string(int length); string(string & str); string(const char *str); const string & operator=(const char str[]); const string & operator+=(const char str[]); const string & operator-()const; const char & operator[](int index) const; operator char*() const; char & operator[](const int index); ~string(); void put(); char *inner; operator int()const; };
C++程序设计教学课件:12 THE C++ INPUT OUTPUT CLASS HIERARCHY.ppt
C++程序设计教学课件:CHAPTER 12 THE C++ INPUT OUTPUT CLASS HIERARCHY.ppt


