MCPcopy Create free account
hub / github.com/CodeWithHarry/The-Ultimate-Python-Course / Number

Class Number

Chapter 11/07_operator_overloading.py:1–6  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class Number:
2 def __init__(self, n):
3 self.n = n
4
5 def __add__(self, num):
6 return self.n + num.n
7
8n = Number(1)
9m = Number(2)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected