messier79
Messages postés10Date d'inscriptionsamedi 24 janvier 2004StatutMembreDernière intervention23 avril 2004
-
22 avril 2004 à 23:37
ymca2003
Messages postés2070Date d'inscriptionmardi 22 avril 2003StatutMembreDernière intervention 3 juillet 2006
-
23 avril 2004 à 23:31
Bonjour
J'essaie de definir mes propres exceptions. Pour celà, j'ai un fichier .h :
Code:
#ifndef EXCEPTION_H
#define EXCEPTION_H
#include <string>
#include <conio.h>
using namespace std;
class StandardException : public exception
{
protected :
string msg;
InFileException::InFileException(string msgerr)
{
msg="Une erreur s'est produite a l'ouverture du fichier de donnees.\n";
msg+="Verifiez l'existence des fichiers passes en parametre et reessayez.\n";
msg+="Si le probleme persiste, contactez l'Administrateur.\n\n";
}
...
A la compilation, j'obtiens :
Code:
Exceptions.cpp:8: declaration of `StandardException::StandardException()'
throws different exceptions
Exceptions.h:15: than previous declaration `
StandardException::StandardException() throw ()'
Exceptions.cpp:13: declaration of `
StandardException::StandardException(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >)' throws different exceptions
Exceptions.h:18: than previous declaration `
StandardException::StandardException(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >) throw ()'
Exceptions.cpp:18: prototype for `std::string StandardException::what()' does
not match any in class `StandardException'
Exceptions.h:20: candidate is: virtual const char* StandardException::what()
const
ymca2003
Messages postés2070Date d'inscriptionmardi 22 avril 2003StatutMembreDernière intervention 3 juillet 20067 23 avril 2004 à 23:31
il ne veut peut-être pas de la clause Throw() pour un destructeur.
D'autre part, je ne vois pas à quoi servent ces clauses dans des fct vu qu'aucune d'entre elles ne génère une exception.