Functions with Default Arguments/Parameters

Posted on April 18, 2013. Filed under: C++ |


c++ functions can have default arguments.
For example, the following function takes default values if caller don’t supply any arguments.
int volume(int l=1, int w=2, int h=5);

volume() is explicitly volume(1,2,5)
volume(10) is explicitly volume(10,2,5)

Advertisements

Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: