Type name expected: Errors

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top