Describe how to overload various operators.
Chapter20: Creating A Presentation
Section: Chapter Questions
Problem 2QY
Related questions
Question
Describe how to overload various operators.
Expert Solution
Step 1: Note
Operator overloading is explained below with C++ programming language.
Step 2: Definition
Operator overloading:
Operator overloading refers to the use of an operator to produce “2” or more meanings to it.
Restrictions on Operator overloading:
- Not all operators can be overloaded. Only specific set of operators can be overloaded.
- Precedence of the operator is not able to be changed on overloading.
Syntax to overload the operator:
returntype class_name :: Operator operator_symbol(arguments)
{
//Function body
}
Step by step
Solved in 3 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you