Type name expected: Errors

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrew Edwards

    Type name expected: Errors

    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,mySt ruct> X;
    return 0;
    }

    ---------- Capture Output ----------
    "C:\Borland\BCC 55\Bin\bcc32.ex e" 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


  • Andrew Edwards

    #2
    Re: Type name expected: Errors

    Gentlemen,

    Thank you, I have finally figured out my problem.

    Andrew


    Comment

    Working...