What is method "Overloading" in object-oriented programming (OOP) ?

Method or function overloading allows a method with the same name to be declared more than once given that they have different input parameters.
For example, there is a method to calculate the area of shapes. There are different shapes such as circles and rectangles. In these two cases, if someone calls the function calculateArea, the result should be correct for the given shape, regardless of whether the shape is a circle or a rectangle. The declaration of this in a programming language in shown below:
Rectangle: calculateArea(double length, double width
Circle: calculateArea(double radius)
A great advantage of method overloading is that it allows a programmer to use the function appropriately without having to know the inner-workings of that method. 

AS
Answered by Argha S. Computing tutor

25729 Views

See similar Computing A Level tutors

Related Computing A Level answers

All answers ▸

Explain how the even parity system works when transmitting ASCII codes. Include a description of the roles of the sending device and the receiving device during transmission.


State the main features of a tree


In Python, write a recursive function that returns the first n Fibonacci numbers.


A binary, 8-bit floating point number 0111 0010 is said to have a 4-bit mantissa and a 4-bit exponent. What is meant by the terms 'mantissa' and 'exponent'? What is the value of this 8-bit binary floating point number?


We're here to help

contact us iconContact usWhatsapp logoMessage us on Whatsapptelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

© MyTutorWeb Ltd 2013–2025

Terms & Conditions|Privacy Policy
Cookie Preferences