A
Andrew Edwards
Could someone please tell me what I'm doing wrong? The compiler barks at me
whenever I throw (bad_alloc). If I remove this the code compiles just fine.
template < class DT, class KF >
class BSTree;
template < class DT, class KF >
class BSTreeNode
{
private:
friend class BSTree<DT,KF>;
};
template < class DT, class KF >
class BSTree
{
void insert ( const DT &newDataItem )
throw ( bad_alloc );
};
template < class DT, class KF >
void insert ( const DT& newDataItem )
throw ( bad_alloc )
{
}
int main()
{
BSTree<int,myStruct> X;
return 0;
}
---------- Capture Output ----------
"C:\Borland\BCC55\Bin\bcc32.exe" C:\lab11\Text3.cpp
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
C:\lab11\Text3.cpp:
Error E2303 C:\lab11\Text3.cpp 15: Type name expected
Error E2303 C:\lab11\Text3.cpp 20: Type name expected
*** 2 errors in Compile ***
Terminated with exit code 1
whenever I throw (bad_alloc). If I remove this the code compiles just fine.
template < class DT, class KF >
class BSTree;
template < class DT, class KF >
class BSTreeNode
{
private:
friend class BSTree<DT,KF>;
};
template < class DT, class KF >
class BSTree
{
void insert ( const DT &newDataItem )
throw ( bad_alloc );
};
template < class DT, class KF >
void insert ( const DT& newDataItem )
throw ( bad_alloc )
{
}
int main()
{
BSTree<int,myStruct> X;
return 0;
}
---------- Capture Output ----------
"C:\Borland\BCC55\Bin\bcc32.exe" C:\lab11\Text3.cpp
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
C:\lab11\Text3.cpp:
Error E2303 C:\lab11\Text3.cpp 15: Type name expected
Error E2303 C:\lab11\Text3.cpp 20: Type name expected
*** 2 errors in Compile ***
Terminated with exit code 1