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

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -