Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

default arguments

 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!
I am working on some code for a frame grabber using the Java Native Interface. One method needs a boolean argument which tells whether or not to sync on the green channel, but ONLY if the input is RGB (as opposed to s-video or composite).
So my question is:
in C++, I could define a method with a default argument such as
int setConfig(int videoType, boolean syncOnGreen = false);
If the second argument is not provided, it defaults to false;
Is there an equivalent way of doing this with Java/JNI?
Thanks in advance.
Stephanie
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no equivalent to the C++ shortcut to do it, but you can get the same effect by overloading the method:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic