Is this jQuery like syntax valid in Java? -
in c++, chain-able syntax invalid.
builder.setmessage("are sure want exit?") .setcancelable(false) .setpositivebutton("yes", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { act.finish(); } }) .setnegativebutton("no", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { dialog.cancel(); } });
as long methods return same object, work fine.
it work in c++ too, except anonymous inner classes. (which c++ doesn't support until c++0x)
however, in c++, more performant return pointers , use ->
operator.
Comments
Post a Comment