Wie die Erben von std::runtime_error?

Beispiel:

#include <stdexcept>
class A { };
class err : public A, public std::runtime_error("") { };
int main() {
   err x;
   return 0;
}

Mit ("") nach runtime_error ich bekommen:

error: expected '{' before '(' token
error: expected unqualified-id before string constant
error: expected ')' before string constant

sonst (ohne ("")) bekomme ich

In constructor 'err::err()':
error: no matching function for call to 'std::runtime_error::runtime_error()'

Was mache ich falsch?

(Sie können es hier testen: http://www.compileonline.com/compile_cpp_online.php)

InformationsquelleAutor mchen | 2013-05-13
Schreibe einen Kommentar