Skip to content

polymorphism #1

@zsnmbkmnc

Description

@zsnmbkmnc

https://github.com/jwcnmr/jameswcooper/tree/main/Pythonpatterns/1.%20Intorduction%20to%20Objects/addnumstype.py

This file defines addNums method twice, but adding simple prints in bodies of those definitions (e.g. print("func one") and print("func two")) shows that the only method invoked is the second one (last one defined, technically). Alternatively, you could try to change the order of definitions - this would raise the error during execution.

Such polymorphism doesn't exist in Python.

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions