hi all, quick question about templates and static methods

#include <string>

class FooName
{
static std::string get_name() { return "Foo"; }
};


template <class NamePolicy>
class Foo
{
public:
Foo() = default;
static std::string get_name() { return m_policy.get_name(); }

private:

NamePolicy m_policy;
};


int main()
{
auto s = Foo<FooName>::get_name();
}
 
why doesn;t this compile? it says 'left of get_name must be struct / class union'

on line
 
static std::string get_name() { return m_policy.get_name(); }

 
 
 
 
You already invited:

If you wanna answer this question please Login or Register