rjshkrmara
rjshkrmara

Reputation: 79

How can i call function with structure in c++

Can anybody help me with the following code. I have declared one structure inside namespace nad structure contains one function. How can I call fun() in the code.

namespace aaa {
  struct bbb {
    void fun();
  }
}

Upvotes: 1

Views: 83

Answers (1)

Simple
Simple

Reputation: 14390

fun is a non-static member function, which means you need an instance of it:

aaa::bbb x;
x.fun();

Upvotes: 1

Related Questions