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 C# program named ProjectedRaises that includes a named constant representing next year’s anticipated 4 percent raise for
nydimaria [60]

Answer:

using System;

class ProjectedRaises {

 static void Main() {

     const float raise = 0.04f;

     double salary1 = 0.0f,salary2 = 0.0f,salary3 = 0.0f;

Console.WriteLine("Current salary for each employee: ");

     salary1 = Single.Parse(Console.ReadLine());

     salary2 = Single.Parse(Console.ReadLine());

     salary3 = Single.Parse(Console.ReadLine());

     salary1 = salary1 + raise * salary1;

     salary2 = salary2 + raise * salary2;

     salary3 = salary3 + raise * salary3;

     Console.WriteLine("Next year salary for the employees are: ");

     Console.WriteLine(Math.Round(salary1));

     Console.WriteLine(Math.Round(salary2));

     Console.WriteLine(Math.Round(salary3));

}

}

Explanation:

This declares and initializes variable raise as a float constant

     const float raise = 0.04f;

This declares the salary of each employee as double

     double salary1 = 0.0f,salary2 = 0.0f,salary3 = 0.0f;

This prompts the user for the salaries of the employee

Console.WriteLine("Current salary for each employee: ");

The next three lines get the salary of the employees

<em>      salary1 = Single.Parse(Console.ReadLine());</em>

<em>      salary2 = Single.Parse(Console.ReadLine()); </em>

<em>      salary3 = Single.Parse(Console.ReadLine()); </em>

The next three lines calculate the new salaries of the employees

<em>      salary1 = salary1 + raise * salary1;</em>

<em>      salary2 = salary2 + raise * salary2;</em>

<em>      salary3 = salary3 + raise * salary3;</em>

This prints the header

     Console.WriteLine("Next year salary for the employees are: ");

The next three lines print the new salaries of the employees

     Console.WriteLine(Math.Round(salary1));

     Console.WriteLine(Math.Round(salary2));

     Console.WriteLine(Math.Round(salary3));

7 0
3 years ago
Identify when programmers use an Else statement.
Gnesinka [82]

Answer:

to tell the program to take a different action when the If statement answer is false

Explanation:

if x = 0:

     print('x equals 0')

else:

      print('x equals something else that isnt 0')

4 0
3 years ago
Read 2 more answers
Which button will allow you to insert quotes and notes into text into a document​
oksano4ka [1.4K]

Answer:

You copy and paste it

Explanation:

right click on the mouse then it will say copy, you right click on the mouse and click paste voila! it works! (If you're using word there are 3 options for pasting, Keep source formatting, Merge formatting and keep text only)

8 0
3 years ago
Prewritten, commercially available sets of software programs that eliminate the need for a firm to write its own software progra
Irina18 [472]

Answer:

Option A i.e., software package.

Explanation:

Prewritten, available on the market the software packages, which not necessitate a company's desire to actually compose its software for certain functionalities, will be applied to as software packages.

A software package is essentially a finite number of programs or software components that function together so that they achieve different tasks and objectives.

5 0
3 years ago
Which of the following are pointers?
Pachacha [2.7K]

Answer:

Is there any options here

4 0
3 years ago
Other questions:
  • What are five features of word 2016 you would use to capture the attention of the target audience? Defend you decisions
    9·1 answer
  • If you wanted to create a graph that showed how much each value contributed to the whole value, you would use a _____.
    15·2 answers
  • __________ ensure that hardware and software produced by different vendors work together.
    14·1 answer
  • Corey is an architect. What software does he most likely use to design houses? graphic software scheduling software CAD software
    10·2 answers
  • ​For complex models, analysts can choose computer-based modeling tools that use _____, which includes standard shapes and symbol
    10·1 answer
  • A third-grade teacher at Potter Elementary School wants a program that allows a student to enter the amount of money a customer
    14·1 answer
  • Which is a natural hazard that can cause extinctions? Choose all that apply.
    6·1 answer
  • What major criteria must a product or process meet in order to be considered emerging technology?
    6·1 answer
  • Which alignment aligns text to the left and right side margins?
    15·1 answer
  • What are Database administrators? <br> Thank you :)
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!