954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How do I define static methods in classes that are in a namespace

alright, I'm a bit stuck here, I've tried a few things but I can't figure it out.

Question is in the source:

// test.h
namespace test
{
  class foo
  {
    static void test();
  };
}
// test.cpp
#include "test.h"
namespace test
{
  // how can I define test() without getting without getting compiler errors?
}
bbman
Junior Poster
182 posts since May 2010
Reputation Points: 22
Solved Threads: 10
 

figured it out, I was being so stupid, I forgot to include the header >_<

anyway, for those interested:

// test.cpp
#include "test.h"
namespace test
{
  void foo::test() {}
}
bbman
Junior Poster
182 posts since May 2010
Reputation Points: 22
Solved Threads: 10
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: