Advertisement
Advertisement
#include<iostream>
using namespace std;
class Excp
{
public:
void function1();
void function2();
void function3();
};
void Excp :: function1()
{
function2();
};
void Excp :: function2()
{
function3();
}
void Excp :: function3()
{
int a = 20;
int b = 20;
int c = x/(x-y); //This will throw an exception because we are dividing a number with zero i.e. x-y is 0
cout<<"Hello"; //This statement will not be executed.
}
int main()
{
Excp ob;
ob.function1();
}
Advertisement
Advertisement
Please check our latest addition
C#, PYTHON and DJANGO
Advertisement