C++ language

R4R® C++
(追記) (追記ここまで)
(追記) (追記ここまで)
Program Of Function Overloading
#include<stdio.h>
void myfunction(int a)
{
cout<<"a is "<<a;
//overload myfunction
void myfunction(int a, int b)
{
cout<<"a is"<<a;
cout<<"b is"<<b;
}
//overload myfunction again
void myfunction(int a, double b)
{
cout<<"a is"<<a;
cout<<"b is"<<b;
}
void main()
{
myfunction(12); //calls myfunction(int)
myfunction(10,34) //calls myfunction(int, int)
myfunction(67,123.45) //calls myfunction(int, double)
}

output:

a is 12
a is 10
b is 34
a is 67
b is 123.45
(追記) (追記ここまで)
Copyright ©2021-22 r4r.co.in, all rights reserved. Theguestspost.com
Sitemap
Career
Post comment
About us
Subscription
Unsubscription

AltStyle によって変換されたページ (->オリジナル) /