21 lines
368 B
Plaintext
21 lines
368 B
Plaintext
=== Noncompliant code example
|
|
|
|
[source,text]
|
|
----
|
|
class BaseException { };
|
|
class DerivedException: public BaseException { };
|
|
|
|
try
|
|
{
|
|
// ...
|
|
}
|
|
catch ( BaseException &b ) // Will catch DerivedException as well
|
|
{
|
|
// ...
|
|
}
|
|
catch ( DerivedException &d ) // Noncompliant, the previous handled effectively hides this one
|
|
{
|
|
// Any code here will be unreachable,
|
|
}
|
|
----
|