This is the feature of C++ if a programmer put any value for default which appear unless any value is input.
Here you can see on the function named 'display' we just input the value of a is 67 if no other value is supplied. later when we put the value of 500 in the function it overwrite and give the last value which we input.
/*Default Argument*/
#include<iostream>
using namespace std;
void display(int a=67){
cout<<a<<endl;
}
int main(){
display();
cout<<endl;
display(500);
return 0;}
0 Comments had been done yet:
Post a Comment