A PHP Error was encountered

Severity: Warning

Message: fopen(/var/cpanel/php/sessions/ea-php56/PHPSESSID5ovt1a2aigj3tn3f04q5dafitn9mdp1n): failed to open stream: No space left on device

Filename: drivers/Session_files_driver.php

Line Number: 174

C++ program to demonstrate example of function overloading
Q:

C++ program to demonstrate example of function overloading

0

C++ program to demonstrate example of function overloading

Function overloading is an important feature in C++, using function overloading – in a block/ scope we can declare multiple functions with same name. Function overloading can be done by using different type and number of arguments; it does not depend on return type of the function.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Function overloading example in C++.

/*C++ program to demonstrate example of function overloading.*/
#include  <iostream>
using namespace std;
 
void printChar();
void printChar( char c );
void printChar( char c, int num );
void printChar(int num, char c);
 
int main()
{
    printChar();
    printChar('#');
    printChar(10,'$');
    printChar('@',10);
     
    cout<< endl;
         
    return 0;
}
 
void printChar()
{
        cout<< endl<<"%";
}
void printChar( char c )
{
        cout<< endl<< c;
}
void printChar( char c, int num )
{
    int i=0;
         
    cout<< endl;
    for(i=0; i< num; i++)
        cout<< c;
}
void printChar(int num, char c)
{
    int i=0;
         
    cout<< endl;
    for(i=0; i< num; i++)
        cout<< c;
}

Output

    %
    #
    $$$$$$$$$$
    @@@@@@@@@@

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Most popular and Searched C++ solved programs with Explanation and Output

Similar questions


need a help?


find thousands of online teachers now
C++ program to read string using cin.getline()... >>
<< C++ program to demonstrate methods of passing argu...

A PHP Error was encountered

Severity: Warning

Message: Unknown: Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/cpanel/php/sessions/ea-php56)

Filename: Unknown

Line Number: 0