Presentation is loading. Please wait.

Presentation is loading. Please wait.

Default Arguments.

Similar presentations


Presentation on theme: "Default Arguments."— Presentation transcript:

1 Default Arguments

2 void blanklines (const short num_lines = 4);  
int main() { blanklines(8);    blanklines(33);   blanklines();  return 0; } void blanklines (const short num_lines)  {     for (short i = 1; i <= num_lines; i++)         cout<<endl;     return; }    

3 void blanklines (const short num_lines = 4);  
int main() { blanklines(8);    blanklines(33);   blanklines();  return 0; } void blanklines (const short num_lines)  {     for (short i = 1; i <= num_lines; i++)         cout<<endl;     return; }    

4 void blanklines (const short num_lines = 4);  
int main() { blanklines(8);    blanklines(33);   blanklines();  return 0; } void blanklines (const short num_lines)  {     for (short i = 1; i <= num_lines; i++)         cout<<endl;     return; }    

5 void blanklines (const short num_lines = 4);  
int main() { blanklines(8);    blanklines(33);   blanklines();  return 0; } void blanklines (const short num_lines)  {     for (short i = 1; i <= num_lines; i++)         cout<<endl;     return; }    

6 void blanklines (const short num_lines = 4);  
int main() { blanklines(8);    blanklines(33);   blanklines();  return 0; } void blanklines (const short num_lines)  {     for (short i = 1; i <= num_lines; i++)         cout<<endl;     return; }    

7 void blanklines (const short num_lines = 4);  
int main() { blanklines(8);    blanklines(33);   blanklines();  return 0; } void blanklines (const short num_lines)  {     for (short i = 1; i <= num_lines; i++)         cout<<endl;     return; }    

8 void my_function (int a=6, char b=‘a’, float c=8
void my_function (int a=6, char b=‘a’, float c=8.9, long d=11, double e=22.5); void my_function (int a, char b=‘a’, float c=8.9, long d=11, double e=22.5); void my_function (int a, char b, float c=8.9, long d=11, double e=22.5); void my_function (int a, char b, float c, long d=11, double e=22.5); void my_function (int a, char b, float c, long d, double e=22.5); void my_function (int a, char b, float c, long d, double e); void my_function (int a, char b=‘a’, float c, long d, double e);

9 void my_function (int a=6, char b=‘a’, float c=8
void my_function (int a=6, char b=‘a’, float c=8.9, long d=11, double e=22.5); void my_function (int a, char b=‘a’, float c=8.9, long d=11, double e=22.5); void my_function (int a, char b, float c=8.9, long d=11, double e=22.5); void my_function (int a, char b, float c, long d=11, double e=22.5); void my_function (int a, char b, float c, long d, double e=22.5); void my_function (int a, char b, float c, long d, double e); void my_function (int a, char b=‘a’, float c, long d, double e);

10 void my_function (int a=6, char b=‘a’, float c=8
void my_function (int a=6, char b=‘a’, float c=8.9, long d=11, double e=22.5); void my_function (int a, char b=‘a’, float c=8.9, long d=11, double e=22.5); void my_function (int a, char b, float c=8.9, long d=11, double e=22.5); void my_function (int a, char b, float c, long d=11, double e=22.5); void my_function (int a, char b, float c, long d, double e=22.5); void my_function (int a, char b, float c, long d, double e); void my_function (int a, char b=‘a’, float c, long d, double e);

11 void my_function (int a, char b, float c = 1
void my_function (int a, char b, float c = 1.2, long d = 4, double e = 7.8) {…} int main() { my_function (4,’z’,5.5,6,88.98); my_function (4,’z’,3.5,7); my_funciton (3,’g’); return 0; }

12 void my_function (int a, char b, float c = 1
void my_function (int a, char b, float c = 1.2, long d = 4, double e = 7.8) {…} int main() { my_function (4,’z’,5.5,6,88.98); my_function (4,’z’,3.5,7); my_funciton (3,’g’); return 0; }

13 void my_function (int a, char b, float c = 1
void my_function (int a, char b, float c = 1.2, long d = 4, double e = 7.8) {…} int main() { my_function (4,’z’,5.5,6,88.98); my_function (4,’z’,3.5,7); my_funciton (3,’g’); return 0; }

14 End of Session


Download ppt "Default Arguments."

Similar presentations


Ads by Google