Exceptions Questions

Posted on 2006-04-24
Last Modified: 2010-04-01
It appears that the what() function is a member of the <exception> class. I have seen several other exceptions classes simply inherits the exeception class and then overrides the what() as virtual what().
But I have seen  the docs of the std. <exception> template functions and I do not see a what() there.
Anyone knows if what() is really a member of the <exception> OR is it inherits from some other class?.

I am coming from a Java background and writing some C++ code. One thing....Nothing to beat Javadocs style Java documemtation. C++ is no where near. Sorry. I am not bashing.

I home someone will point me to some place on the web or throw his/her two cents on this.

Question by:prain
    LVL 15

    Accepted Solution

    The what function is a member of the std::exception class declared in the <exception> header file.  This is specified in section 18.6.1 of the C++ standard.  The function is declared like this:

    virtual const char* what() const throw();

    You can read about it in this tutorial:
    LVL 17

    Expert Comment

    > Nothing to beat Javadocs style Java documemtation

    Agreed. C++ has a poor cousin of Javadoc called Doxygen, but I've yet to see it applied to the standard libraries. If it was adopted in the drafting of the C++ standard, it might be more widley used in standard library implementations and indeed 3rd party libraries, but the standard was drafted by a committee and it took long enough to draft without needing to reach a concensus about documentation.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Live - One-on-One C++ Help from Top Experts

    Solve your toughest problems, fast.
    C++ experts are online now and ready to help you.

    Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
    C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (…
    The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
    The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now