c++ catch exceptions when we use inhereted classes -
i have code this:
class a{}; class b : {}; void foo() { throw new b; } here can catch exception using catch(b *e). why can not catch using catch(a *e). because private access type in inheritance?
yes that's why.
since b inherits a privately, no 1 except b aware of inheritance. b object not considered a object , cannot converted instance of a.
Comments
Post a Comment