Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 722 Bytes

File metadata and controls

28 lines (19 loc) · 722 Bytes

Module 055: Operator Overloading

  • Phase: 6. Advanced OOP & Errors
  • Duration: 1.5 hours

Learning Objectives

  • Overload arithmetic operators (+, -, *, /)
  • Overload comparison operators (==, <, <=, >, >=, !=)
  • Overload unary operators (-, +, abs())
  • Make custom classes work with Python's built-in operators
  • Implement a practical Vector class

Topics Covered

  • __add__, __sub__, __mul__, __truediv__
  • __eq__, __lt__, __le__, __gt__, __ge__, __ne__
  • __neg__, __pos__, __abs__
  • Return type conventions for overloaded operators
  • Practical Vector(x, y) example

Prerequisites

Module 054: Enums

Next Module

Module 056: Error Handling