Python dunder functions and operator overloading by implementing the Complex Number class. Polymorphism means "different forms". So far we have created methods and dunder methods (operator overloading) as 2 ways of doing the same thing. For instance, we can create an add( ) method, or overload the __add__ operator.

We can apply the concept of polymorphism in our Complex Number class for function parameters. Here, we can add other Complex Number types or simple integers to our Complex Number. Unlike other programming languages, Python does not allow us to overload methods (define multiple functions with the same name). Instead since Python is dynamically typed, we can simply check the type of the value passed in to replicate this concept.

For more information on Complex Numbers:
https://www.mathsisfun.com/numbers/complex-numbers.html

Source Code:
https://github.com/ImKennyYip/python-oop

Python Object Oriented Programming Playlist:
https://www.youtube.com/playlist?list=PLnKe36F30Y4Ykmi2jE28BZahMgPAV3Dzv

Python Data Structures and Algorithms Playlist:
https://www.youtube.com/playlist?list=PLnKe36F30Y4bcRomKi02sP9NR27KnBqCK

Python Game Programming Projects Playlist:
https://www.youtube.com/playlist?list=PLnKe36F30Y4bamRi07AOYS1qGDv_2MGMW

Subscribe for more coding tutorials !