Re: optional arguments in BGT (looks like cpp)

  • From: "Littlefield, Tyler" <tyler@xxxxxxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Sat, 27 Aug 2011 11:41:25 -0600

bool foo(int a, int b=3, int c=4). you forgot a )
On 8/27/2011 11:21 AM, Alex Hall wrote:
Hi all
I am working with BGT, the Blind Gamer's Toolkit, which looks like little more than convenience wrappers over cpp. So, if you know cpp, you can probably answer this one: how do I make an argument optional? I thought I would start getting used to the language by adding hotkeys to the built-in dynamic_menu library. It works, but I can't see how to make the inclusion of a key optional. When the method is:
bool add_item_tts(string option, int accessKey
it works perfectly.  However, when I change it to
bool add_item_tts(string option, int accessKey=0
I get a bunch of errors, the first being that, on that line, "expected ) or ','". This is followed by "a method or object was expected", and more after that. Online, this looks like how you do it; any optional arguments (those with a default value) go at the end of the list and are written as "type name=val". Apparently, though, I am missing something. Thanks.

Have a great day,
Alex (msg sent from BrailleNote
mehgcap@xxxxxxxxx; http://www.facebook.com/mehgcap
__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind




--

Take care,
Ty
my website:
http://tds-solutions.net
my blog:
http://tds-solutions.net/blog
skype: st8amnd127
My programs don't have bugs; they're randomly added features!

__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: