I have a class like this:
#include "Blarg.h"
// ...
class Foo : public Bar {
// ...
static double m_value;
// ...
};
And another one like this:
template<class X, class Y>
class Blarg : public Bar {
// ...
void SetValue(double _val) { Foo::m_value = _val; }
// ...
};
Since Foo
's m_value
is private (and I would like to keep it that way), I thought I would declare the SetValue
function as a friend to the Foo
class so that it could access the static member when needed.
I've tried declarations along these lines within Foo
's public area:
template<class X, class Y> friend void Blarg<X, Y>::SetValue(double _val);
template<class X, class Y> friend void Blarg::SetValue(double _val);
friend void Blarg::SetValue(double _val);
...but no luck in compiling. What is the proper syntax for this, if possible?