|
![]() | 作者: pcfan [pcfan]
![]() |
登录 |
#ifndef DATALIST_H #define DATALIST_H #include <iostream.h> template < class Type > class dataList { private: Type * Element; int ArraySize; void Swap (const int mark1, const int mark2); int MaxKey (const int low, const int high); public: dataList (int size = 10):ArraySize(size),Element(new Type[Size]) {} ~dataList () {delete[] Element; } void Sort (); friend ostream& operator << (ostream& outStream, const datalist<Type> & outList); friend istream& operator << (istream& inStream, const datalist<type> & inList); }; #endif ERROR: atalist.cpp(16) : error C2143: syntax error : missing ',' before '<' datalist.cpp(18) :see reference to class template instantiation 'dataList<Type>' being compiled datalist.cpp(16) : error C2059: syntax error : '<' datalist.cpp(18) : see reference to class template instantiation 'dataList<Type>' being compiled datalist.cpp(17) : error C2143: syntax error : missing ',' before '<' datalist.cpp(18) : see reference to class template instantiation 'dataList<Type>' being compiled datalist.cpp(17) : error C2059: syntax error : '<' datalist.cpp(18) : see reference to class template instantiation 'dataList<Type>' being compiled [此贴被 冰魂(pcfan) 在 6月29日14时38分 编辑过] |
地主 发表时间: 6/29 14:12 |
![]() | 回复: becks11 [becks11] ![]() |
登录 |
反正少了些函数。 |
B1层 发表时间: 06/30 12:28 |
![]() | 回复: easyking [easyking] ![]() |
登录 |
#ifndef DATALIST_H #define DATALIST_H #include <iostream.h> template < class Type > class dataList { private: Type * Element; int ArraySize; void Swap (const int mark1, const int mark2); int MaxKey (const int low, const int high); public: dataList (int size = 10):ArraySize(size),Element(new Type[Size]){} ~dataList () { delete[] Element; } void Sort () { friend ostream& operator << (ostream& outStream, const datalist<Type> & outList); friend istream& operator << (istream& inStream, const datalist<type> & inList); } }; #endif 不知对否? |
B2层 发表时间: 06/30 14:33 |
![]() | 回复: pcfan [pcfan] ![]() |
登录 |
非常感谢。 你的没有问题了。 原来是VOID SORT()函数那个出了问题, 我是初学VC++, 还请以后多指教。 [此贴被 冰魂(pcfan) 在 6月30日21时42分 编辑过] |
B3层 发表时间: 6/30 21:52 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号