1/13 Chapter 06- Implementing Operators in a class
2/13 Objectives Definitions How to implement operators which will act on objects
3/ Definitions Conventional definitions Operator: Symbol that represent an operation which returns a value. Operand: Data that will be acted on by an operator. Result: New datum will be created after the operation executed. Types of operators: Unary operators ++, -- Binary operators + - * && & Ternary operators?: Overriding an opertor: Re-defining the operation of an operator
4/ Borland C++ operators C++ supports overriding functions and operators also. Operators cannot be overriden:..* :: ?: # ##
5/ Syntax of opertor implementation
6/ Unary,Binary operator Demo
7/ Operator [] Demo [ ] operator can accept only one parameter
8/ Operator ( ) Demo
9/13 Operator ( ) Demo …
10/ Operator with string parameter
11/13 Operator with string parameter…
12/13 Summary Syntax for implementing operator in a class DataType operator Symbol (Parameters) { }
13/13 THANKS