void updateFilter(bool bRecalc = true); | General C++ Topics | Forum


Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
void updateFilter(bool bRecalc = true);
September 11, 2013 - 4:47 am
Member Since: August 27, 2013
Forum Posts: 13
sp_UserOfflineSmall Offline

Here's the line of code I'm having issues understanding.

void updateFilter(bool bRecalc = true);

We have a prototype here that has been placed in my main header file. What is the purpose of setting bRecalc within this declaration? I would expect this to look like:

void updateFilter(bool bRecalc);

Thanks for the help.

September 11, 2013 - 5:05 am
Member Since: August 27, 2013
Forum Posts: 13
sp_UserOfflineSmall Offline

My best guess is that it allows for the function call to have no value passed to it, and the default value will be true.

September 11, 2013 - 7:26 pm
Member Since: January 29, 2017
Forum Posts: 693
sp_UserOfflineSmall Offline

Yes, that sets the default behavior so updateFilter() does the same thing as updateFilter(true). There are restrictions when you do this with multiple arguments (the ones with defaults have to be at the end of the list).

See also:


- Will

Forum Timezone: America/New_York

Most Users Ever Online: 152

Currently Online:
3 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Chaes: 56

Skyler: 48

StevieD: 46

Derek: 46

Frodson: 45

Peter: 43

TheSmile: 43

Nickolai: 43

clau_ste: 39

jeanlecode: 37

Member Stats:

Guest Posters: 2

Members: 784

Moderators: 1

Admins: 6

Forum Stats:

Groups: 13

Forums: 42

Topics: 850

Posts: 3372

Moderators: W Pirkle: 693