If I have a class in a namespace, like this:

#ifndef MyClass_h
#define MyClass_h

namespace NyNamespace
{
	class MyClass
	{
		public:
			typedef double MyType;
			MyType Read();
	};
}

#endif

And the implementation:

#include "MyClass.h"

namespace MyNamespace
{

MyClass::MyType MyClass::Read()
	{
		MyClass::MyType A;
		return A;
	}
}

I get error: 'MyClass' has not been declared.

Why does this not work?

Thanks!
Dave

Recommended Answers

All 2 Replies

namespace [B]N[/B]yNamespace
namespace MyNamespace

Wow, unbelievable! Seems like there should be some better way to catch this, like "this namespace does not exist".

Sorry for the stupid typo - thanks though.

Dave

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.