English, asked by haertbeatbadboy, 15 hours ago

Write the c program to write the volume of defferent shapes using function overloading​

Answers

Answered by Anonymous
1

Answer:

What is function overloading in c++?

Function overloading is a programming concept that allows you to define two or more functions with the same name.

Its not specific to C++ even Java(method overloading),Python and some other programming languages supports the concept of Function overloading.

The following are the ways to implement Function overloading in C++ :

By changing number of Arguments :-

In this type of function overloading we define two functions with same names but different number of parameters of the same type.

/* Example */

#include<bits/stdc++.h>

  • using namespace std;
  • int aggregate(int a,int b){
  • return (a+b);
  • int aggregate(int a,int b,int c){
  • return (a+b+c);
  • }
  • int main(){
  • /*function calling with two parameters*/
  • cout<<aggregate(10,20)<<endl;
  • /*function calling with three parameters*/
  • cout<<aggregate(10,20,30)<<endl;
  • return 0;
  • }

2. By having different types of argument:-

In this type of overloading we define two or more functions with same name and same number of parameters, but the type of parameter is different.

/* Example */

  • int aggregate(int a,int b){
  • return (a+b);
  • }
  • double aggregate(double a,double b){
  • return (a+b);
  • }
  • /* You may combine these two types of function overloading by making use of generic programming concept in C++ */

Hope Helpful for You ☺️

Explanation:

no sahil l don't want to fall in lv da tell him l want be as a bst frd

Answered by krantibakoriya81
2

Answer:

hii good evening how are you

Similar questions