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 DerivedException();
    }
    catch (BaseException 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: 845

Copyright © 2024. Powered by Intellect Software Ltd