开发者

C++/CLI - syntax for referencing static method from certain namespace

开发者 https://www.devze.com 2023-02-08 02:08 出处:网络
I want to execute a static method from certain class in certain namespace, but I have a problem with using it as a method parameter.

I want to execute a static method from certain class in certain namespace, but I have a problem with using it as a method parameter.

Example:

Lets say there is a class:

namespace ExampleNamespace {
        public ref class A
        {
        public:
            static int MethodA();
        };
}

And I want to use MethodA in oth开发者_JAVA技巧er namespace as a other's method parameter:

MethodB(MethodA());

Only way I can make it work is by writing it like this:

ExampleNamespace::A^ a;
MethodB(a->MethodA());

Is there a way to write it without that 'a' declaration before? Something like

MethodB(ExampleNamespace::A->MethodA()) 

wont work...

Thank you in advance.


 MethodB(ExampleNamespace::A::MethodA());
0

精彩评论

暂无评论...
验证码 换一张
取 消