1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
inna [77]
3 years ago
6

Overloading in methods are popular in programming, and why overloading is important.

Computers and Technology
1 answer:
Cerrena [4.2K]3 years ago
5 0

Answer:

 Yes, overloading is one of the methods which are popular in programming language. Overloading basically refers to the same function but different signature called function overloading or method overloading. It is the ability to define the multiples method by using the single identifier.

The overloading is important because it has the ability to design the multiple method by using similar name. It also provide the high flexibility to the programmers to call the same method in the data. overloading basically provide the high clarity in the code.

Overloading is used to achieved the compile time polymorphism.  

Following are program of function overloading in c++ are:

Class abc // creating class

{

public:

int p;

void fun() // function fun with no parameter/

{

cout<<” hello “;

}

void fun(int a) // function fun with parameter

{

p=a;

cout<<p;

}

};

int main() // main function

{

abc ob; // creating object

ob.fun();// print hello;

ob.fun(6);// print 6

return 0;

}

Explanation:

In this program the function fun() have same name but different signature in the main method we create the object of class abc i.e ob. ob.fun() this statement called the function with no parameter and ob.fun(6) this statement will called the function with integer parameter.

You might be interested in
Write a program that uses a stack to test input strings to determine whether they are palindromes. A palindrome is a sequence of
Maslowich

Answer:

Here the code is given as follows,

Explanation:

def isPalindrome(x):

   stack = []

   #for strings with even length

   if len(x)%2==0:

       for i in range(0,len(x)):

           if i<int(len(x)/2):

               stack.append(x[i])

           elif stack.pop()!=x[i]:

               return False

       if len(stack)>0:

           return false

       return True

   #for strings with odd length    

   else:

       for i in range(0,len(x)):

           if i==int(len(x)/2):

               continue

           elif i<int(len(x)/2):

               stack.append(x[i])

           elif stack.pop()!=x[i]:

               return False

       if len(stack)>0:

           return false

       return True  

def main():  

   while True:  

       string = input("Enter a string or Return to quit: ")  

       if string == "":  

           break  

       elif isPalindrome(string):  

           print("It's a palindrome")  

       else:  

           print("It's not a palindrome")  

if __name__ == '__main__':  

   main()

8 0
3 years ago
What does “default” refer to? the ability to be used as, or directly converted to, cash. the failure to pay back a loan. the amo
Vaselesa [24]
The answer is "the failure to pay back a loan".

In computer systems, we have a different meaning to the word default. It is referred to the setting or option in a computer upon opening a program or application. But according to the dictionary, default refers to the failure to make a payment such as a loan.
8 0
3 years ago
Which of the following best describes the protocols used on the Internet?
ASHA 777 [7]

Answer:

C: The protocols of the Internet are open and used by all devices connected to the network

Explanation:  Hope this helps.  

There are billions of devices connected to the Internet, and hundreds of different kinds of devices: laptops, tablets, phones, refrigerators, handheld credit card readers, and so on. Protocols (standards) ensure that the variety of devices interact with each other smoothly.  There are a lot of protocols! The Internet was designed with several layers of abstraction that sort the protocols according to what part of the process they support.

4 0
3 years ago
After reading passage “the incredible machine” why do you think the article has been titled so?
Vitek1552 [10]
I haven’t read it, but just by the title it was probably talking about an incredible machine that was new to people.
7 0
3 years ago
23
bezimeni [28]
I think the answer is c
7 0
3 years ago
Other questions:
  • Write a program that estimates the approximate number of times the user’s heart has beat in his/her lifetime using an average he
    12·1 answer
  • The problem solving process begins by first ______ the problem.
    11·1 answer
  • Which software application should be used to communicate in writing about an upcoming event?
    12·2 answers
  • According to the video, who is the most common employer for Foresters?
    14·2 answers
  • Suppose a program takes 1000 machine instructions to run from start to end, and can do that in 10 microseconds when no page faul
    9·1 answer
  • #Write a function called "replace_all" that accepts three #arguments: # # - target_string, a string in which to search. # - find
    11·1 answer
  • What is the importance of personal computers in connecting to the internet ?
    13·2 answers
  • An objective function in linearprogramming is a(n):
    11·1 answer
  • Ethan is a systems developer. He is working on a system where he will implement independent solutions for different processes. W
    7·1 answer
  • 1.) Explain one way the internet has impacted the way we behave.
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!