How to call C++ static method

前端 未结 5 671
萌比男神i
萌比男神i 2020-12-30 21:15

Is it possible to return an object from a static method in C++ like there is in Java? I am doing this:

class MyMath {
    public:
       static MyObject calc         


        
5条回答
  •  -上瘾入骨i
    2020-12-30 21:21

    For this case, you want MyMath::calcSomething(). The '.' syntax is for calling functions in objects. The :: syntax is for calling functions in a class or a namespace.

提交回复
热议问题