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 Derived Exception 

B Unknown Exception 

C BaseException 

D Error 

+ Answer
+ Report
Total Preview: 1521

Copyright © 2024. Powered by Intellect Software Ltd