help-gplusplus
[Top][All Lists]
Advanced

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

Re: Inheriting from exception


From: Ulrich Eckhardt
Subject: Re: Inheriting from exception
Date: Wed, 03 May 2006 18:11:34 +0200
User-agent: KNode/0.10.2

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.

> private:
> 
> };

When that's all that is there, you could as well make that a struct because
access to baseclasses and members defaults to public there. Less code to
read and write.

Uli

-- 
http://gcc.gnu.org/faq.html
http://parashift.com/c++-faq-lite/



reply via email to

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