Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Class bad_virtual_result_cast

boost::contract::bad_virtual_result_cast — Exception thrown when inconsistent return values are passed to overridden virtual public functions.

Synopsis

// In header: <boost/contract/core/exception.hpp>


class bad_virtual_result_cast :
  public std::bad_cast, public boost::contract::exception
{
public:
  // construct/copy/destruct
  explicit bad_virtual_result_cast(char const *, char const *);
  ~bad_virtual_result_cast();

  // public member functions
  virtual char const  * what() const;
};

Description

This exception is internally thrown by this library when programmers specify return values for public function overrides in derived classes that are not consistent with the return types of the virtual public functions being overridden in the base classes. This allows this library to give more descriptive error messages in such cases.

See Also:

Public Function Overrides

bad_virtual_result_cast public construct/copy/destruct

  1. explicit bad_virtual_result_cast(char const * from_type_name, 
                                     char const * to_type_name);
    Construct this object with the name of the from- and to- result types.

    Parameters:

    from_type_name

    Name of the from-type (source of the cast).

    to_type_name

    Name of the to-type (destination of the cast).

  2. ~bad_virtual_result_cast();
    Destruct this object.

    Throws: This is declared noexcept (or throw() before C++11).

bad_virtual_result_cast public member functions

  1. virtual char const  * what() const;
    Description for this error (containing both from- and to- type names).

    Throws: This is declared noexcept (or throw() before C++11).


PrevUpHomeNext