第八章 运算符重载.ppt

第八章 运算符重载

8.1 Introduction Use operators with objects (operator overloading) Clearer than function calls for certain classes Operator sensitive to context 8.1 Introduction Examples Stream insertion, bitwise left-shift + Performs arithmetic on multiple types (integers, floats, etc.) 8.2 运算符重载的基础知识 (Fundamentals of Operator Overloading) Types Built in (int, char) or user-defined Can use existing operators with user-defined types Cannot create new operators 8.2 运算符重载的基础知识 (Fundamentals of Operator Overloading) Overloading operators Create a function for the class Name function operator followed by symbol

文档评论(0)

1亿VIP精品文档

相关文档