JustCpp
Repo wih C++ stuff
Loading...
Searching...
No Matches
customException.hpp
Go to the documentation of this file.
1#ifndef CUSTOM_EXCEPTION_HPP
2#define CUSTOM_EXCEPTION_HPP
3
4#include <exception>
5#include <string>
6#include <iostream>
7
8class CException : public std::exception {
9 private:
10 std::string message;
11
12 public:
13 explicit CException(const std::string& msg) : message(msg) {}
14
15 const char* what() {
16 return message.c_str();
17 }
18};
19
21 void example(void);
22 int failing_function(void);
23}
24
25#endif
const char * what()
Definition customException.hpp:15
std::string message
Definition customException.hpp:10
CException(const std::string &msg)
Definition customException.hpp:13
Definition customException.hpp:20
void example(void)
Definition customException.cpp:3
int failing_function(void)
Definition customException.cpp:12