Skip to content
This repository has been archived by the owner on Jul 17, 2019. It is now read-only.

Mocking class and callbacks funcitons in 'anonymous namespace' #204

Open
avinashgoud13 opened this issue Apr 7, 2017 · 0 comments
Open

Comments

@avinashgoud13
Copy link

FileName: MyClass.h

class MyClass {
public: 
	MyClass();

	void Start();
}

Filename: MyClass.cpp

namespace {
	class ServerState() {
	....
	...
	};

ServerState _state;

void readCallBack(void *server){
	......
	}
}

Mocking MyClass::Start()

MyClass::MyClass(){
	// constructor of my class
	_state = NULL;
	_server = NULL;
}
void MyClass::Start() {
	 if (_state != NULL) {
	   // do something
	  return;
	}
	_server = new Server (readCallBack);
	return;
 }

I am getting error, saying ServerState (anonymous namespace)::_state;
Also, readCallBack is undeclared.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant