java - Calling static function on class in C++ -
this question has answer here:
- help c++ static method 5 answers
- how call static function? 2 answers
i writing lot of java now, getting confused java static methods , c++ static functions.
in java, can call static methods class, , use/see it, exmaple:
public class a{ public void static b(){ system.out.println("hello"); } }
you can do, a.b();
can in c++? if so, not popular compared doing in java?
you can that, in c++ using ::
scope operator:
a::b();
and pointed out, if having instance a
of class a
in current scope can call a.b()
. calling static method on instance confusing though, might want avoid it.
Comments
Post a Comment