Operator Overloading is an actively used design pattern. Where different operators have different implementations depending on their arguments.

?Years Old

Languages without Operator Overloading include basic, c, go, java, javascript, modula-2, objective-c, pascal, typescript, visual-basic

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 June 22nd, 2020

Edit Operator Overloading on GitHub