c++ - How to call a class method without creating an instance -


in java can call class method without creating variable instance of class , still call class method:

new database().getsomevaluesoutofsometablejava(); 

if try same c++ error:

new database()->getsomevaluesoutofsometablecpp(); 

am doing wrong? how can achieve same result?

new database().getsomevaluesoutofsometablejava(); 

that does create instance (note new); abandons garbage collector clean up.

in c++, can create temporary object without new:

database().getsomevaluesoutofsometablecpp(); 

this same java example, except temporary destroyed deterministically @ end of statement.

whether should creating temporaries matter.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

mysql - Pass value between different pages (form) with PHP -