help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inheriting from exception


From: red floyd
Subject: Re: Inheriting from exception
Date: Wed, 03 May 2006 16:22:40 GMT
User-agent: Thunderbird 1.5.0.2 (Windows/20060308)

Ulrich Eckhardt wrote:
Marco wrote:
The following code compiles with Microsoft Visual Studio but not with
GNU (version 3.3.3 running on Linux). Is there a way to inhert from
exception in GNU?

How about you tell us the exact errormessage? It might also be worth
reporting the version of the comparison environment.


#include <iostream>
#include <exception>

class Toto : public exception

1st mistake (as already pointed out) it's std::exception.

{
public:
        virtual const char* what() { return "tutu";}

This function signature is simply wrong.

To be more precise:
1. The virtual is redundant.
2. The footprint should be:
      const char *what() const throw();


private:

};



reply via email to

[Prev in Thread] Current Thread [Next in Thread]