假设我有以下这些类:
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?
}