MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / complex

Class complex

Python/Operator_oveloading.py:5–12  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3# + operator overloading.
4
5class complex:
6 def __init__(self, a, b):
7 self.a = a
8 self.b = b
9
10 # adding two objects
11 def __add__(self, other):
12 return self.a + other.a, self.b + other.b
13
14Ob1 = complex(1, 2)
15Ob2 = complex(2, 3)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected