CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Created by Ketan Lalcheta
#include <iostream>
#include <csignal>
// linkage compatibility affects all C library functions that accept a user function pointer as a parameter,such as signal.
// using the extern "C" linkage specification to ensure that the declared linkages are the same.
extern "C" void handler(int signal_num) noexcept(false)
{
throw std::logic_error("divided_by_0_error");
}
class clsTest
{
public:
clsTest(std::string const& name, int id) : m_strName ( name )
{
// set a custom handler for the <SIGFPE> signal.
std::signal( SIGFPE, handler );
m_intGroupId = (id + 1) / ( id - 5);
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run