.. index:: py::builtins::BaseException::operator = .. _doxycast_pypp_classpy_1_1builtins_1_1BaseException_1acd93982d1c81306891ddbf08f16ac3bf: .. _py-builtins-BaseException-operator-assign: *py::builtins::BaseException::*\ operator = =========================================== .. code-block:: cpp BaseException& operator = (const BaseException& other); // 1 BaseException& operator = (BaseException&& other); // 2 Assigns another BaseException object to the object. Parameters ---------- ``other``: Another instance of BaseException. Return value ------------ ``*this``. Example ------- .. code-block:: cpp #include int main() { try { py::BaseException exception; exception = py::BaseException("example exception") py::raise(exception); } catch (py::BaseException& exception) { py::print("exception handled successfully:", exception); } } **Output**: .. code-block:: text exception handled successfully: example exception