The syntax you posted is not valid. I'm presuming you mean something like this:
1 2 3 4 5 6 7 8 9 10 11 12
namespace foo // Create namespace foo
{ class bar // class bar inside namespace foo
{ int x1, x2, x3; // private variables
public:
bar (int m1, int m2, int m3); // constructor
};
};
// Implementation of bar's constructor
// Takes 3 arguments and initializes it's private variables from the arguments
foo::bar::bar (int m1, int m2, int m3) : x1(m1), x2(m2), x3(m3)
{}
Note: We have not done a usingnamespace foo;, so we qualify the constructor by the namespace.