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
Post a Comment