Skip to content

added method overloading in python documentation #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Examples/method_overloading.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
Method Overloading allows different methods to have the same name,
but different signatures where the signature can differ by the number of
input parameters or type of input parameters, or a mixture of both.
Method overloading is also known as Compile-time Polymorphism, Static Polymorphism, or Early binding in Java.
In Method overloading compared to parent argument, child argument will get the highest priority.
Below is an example which demonstrates method overloading
"""


# First product method.
# Takes two argument and print their
# product
def product(a, b):
p = a * b
print(p)

# Second product method
# Takes three argument and print their
# product
def product(a, b, c):
p = a * b*c
print(p)

# Uncommenting the below line shows an error
# product(4, 5)

# This line will call the second product method
product(4, 5, 5)
6 changes: 3 additions & 3 deletions Examples/sample_oo_dashboard/requirements_dashboard.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Faker==0.8.18
flake8==3.7.8
Flask==1.1.1
Flask-Compress==1.4.0
future==0.17.1
future==0.18.3
inflection==0.3.1
itsdangerous==1.1.0
Jinja2==2.10.1
Jinja2==2.11.3
lazy-object-proxy==1.4.2
MarkupSafe==1.1.1
mccabe==0.6.1
Expand All @@ -27,7 +27,7 @@ plotly==4.1.1
pyaml==16.12.2
pycodestyle==2.5.0
pyflakes==2.1.1
Pygments==2.4.2
Pygments==2.7.4
pylev==1.3.0
python-dateutil==2.8.0
pytz==2019.2
Expand Down