假设我有这些课程:
class Base
{
public:
class Foo { ... };
...
};
然后另一个类从基础派生:
class Derived : public Base
{
// no mention or redefinition of nested class "Foo" anywhere in "Derived"
};
这是否意味着我们现在有一个不同的Derived::Foo
,或者是Derived::Foo
完全相同的Base::Foo
?
这是这种情况的一个转折点:如果有人抛出一个实例Derived::Foo
怎么办?在这种情况下是否会被捕获:
catch ( const Base::Foo &ex )
{
// would this also catch an instance of Derived::Foo?
}