jeg har flg. kode
01: #include <iostream>
02: #include <conio.h>
03: #include <exception>
04: using namespace std;
05:
06: class myexception: public exception
07: {
08: virtual const char* what() const
09: {
10: return "My exception happened";
11: }
12: } myex;
13:
14:
15: int main ()
16: {
17:
18: try
19: {
20: throw myex;
21: }
22: catch (exception& e)
23: {
24: cout << e.what() << endl;
25: }
26:
27: getch(); //vent på taste tryk
28: return 0; //retuner, programmet udført med success
29:}
jeg for flg. fejl
9 C:\\Dev-Cpp\\h5\\praktik\\proj\\10082006\\exception\\exception2-test1.cpp looser throw specifier for `virtual const char* myexception::what() const'
59 C:\\Dev-Cpp\\include\\c++\\3.4.2\\exception overriding `virtual const char* std::exception::what() const throw ()'
i exeption headeren
jeg kan ikek helt forstå for sådan som jeg forståer er det meninge af det skulle virke:
http://cplusplus.com/doc/language/tutorial/exceptions.htmlunder Standard exceptions