ShaQ
ShaQ

Reputation: 43

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

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 other 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.

Upvotes: 2

Views: 4901

Answers (1)

Hans Passant
Hans Passant

Reputation: 941990

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

Upvotes: 7

Related Questions