If a class inherits from another and overrides a virtual function, then the exception-specification for the overridden function must be at least as restrictive. What does it mean? Here is an example,
It compiles fine. In the derived class, virtual function foo throws double and in the base class, foo throws int. So double is supposed to be at least as restrictive? Thanks.Code:class B { public: virtual void foo() throw (int) { } }; class D: public B { public: virtual void foo() throw (double) { } };


Reply With Quote
Bookmarks