dimanche 12 juillet 2020

Can we rethrow exception using constructor if yes then why?

Class A
{
  Int a,b;
    Public:-
        A(int a,int b)
          {
             X=a;
             Y=b;
            try
              {
                 if(b==0)
                  throw b;
                  else
                  cout<<a/b;
                 }
               catch(int a)
                {
                  cout<<a; //throw;can we rethrow??then what is purpose of it??
                 }
};

     
 

Aucun commentaire:

Enregistrer un commentaire