Answers for "example of overloading function in c++"

C++
-1

function overloading in c++

#include <iostream>
using namespace std;
 
void print(int i) {
  cout << " Here is int " << i << endl;
}
void print(double  f) {
  cout << " Here is float " << f << endl;
}
void print(char const *c) {
  cout << " Here is char* " << c << endl;
}
 
int main() {
  print(10);
  print(10.10);
  print("ten");
  return 0;
}
Posted by: Guest on January-17-2022
-2

what is operator overloading in c++

1
2
3
4
5
6
7
8
9
10
11
12
Class class_name
    {
        ………………….
        …………………..
    Public 
        Return_type operator symbol (argument ())
        {
            ……………….
            ……………….
        }
    ………………………….
};
Posted by: Guest on April-18-2022

Code answers related to "example of overloading function in c++"

Browse Popular Code Answers by Language