Operator Overloading is an actively used design pattern.
- Operator Overloading ranks in the top 50% of entities I track
- the Operator Overloading wikipedia page
- I have 48 facts about Operator Overloading. what would you like to know? email me and let me know how I can help.
- Read more about Operator Overloading
Languages with Operator Overloading include ada, ceylon, clojure, cpp, csharp, d, dart, eiffel, f-sharp, free-pascal, freebasic, groovy, haskell, io, kotlin, lua, matlab, object-pascal, perl-6, perl, php, python, r, ruby, rust, scala, seed7, smalltalk, swift, visual-basic-dot-net
Example from python:
# Python Program illustrate how # to overload an binary + operator class A: def __init__(self, a): self.a = a # adding two objects def __add__(self, o): return self.a + o.a ob1 = A(1) ob2 = A(2) ob3 = A("Geeks") ob4 = A("For") print(ob1 + ob2) print(ob3 + ob4)
Last updated July 8th, 2019