Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

C++ Language/Objects/OperatorOverloading

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Programming custom implementations for operators is the mechanism for allowing a custom C++ class to be used as a "value type" (which then can behave similar to built-in primitive types like int). For example, client code expects to be able to do int iX = iY + iZ + 9;; if you want your custom class to also behave that way, then define its const CRType CRType::operator+(const CRType& aroRhs) {body}. Additional information about operator overloading (includes interactive examples)