Question:Consider the following code:
class BaseException
{
   public:
   virtual void Output()
   {
      cout << "Base Exception" << endl;
   }
};

class DerivedException : public BaseException
{
   public:
   virtual void Output()
   {
      cout << "Derived Exception" << endl;
   }
};

void ExceptionTest()
{
   try
   {
      throw new DerivedException();
   }
   catch (DerivedException ex)
   {
      ex.Output();
   }
   catch (...)
   {
      cout << "Unknown Exception Thrown!" << endl;
   }
}
Invoking Exception Test will result in which output? 

A Base Exception 

B Derived Exception 

C Unknown Exception Thrown 

D No Output will be generated 

+ Answer
+ Report
Total Preview: 739

Copyright © 2024. Powered by Intellect Software Ltd