compiler madness??

G

g

#ifndef SERVICE_HANDLER_H_
#define SERVICE_HANDLER_H_
#include <string>
#include <map>

class Services;

class Service_Handler
{
public:
Service_Handler();
virtual ~Service_Handler();
Services* getService(std::string transaction,std::string arguments);
private:
std::map<std::string,Services*> transactions;
};

#endif /*SERVICE_HANDLER_H_*/


#include "Service_Handler.h"
#include "Services.h"
#include "CreateCustomer.h"

Service_Handler::Service_Handler()
{
transactions["aaa"]=new Services;
}

Service_Handler::~Service_Handler()
{
transactions.erase("aaa");
}

Services* getService(std::string transaction,std::string arguments)
{
transactions.erase("aaa");
return NULL;
}

.../Service_Handler.cpp: In function 'Services*
getService(std::string, std::string)':
.../Service_Handler.cpp:17: error: 'transactions' was not declared
in this scope
!!!!!!!!!!!!
how it's possible??????????
why I can't use transactions in getService()????
please help!
 
U

Uwe Grawert

g said:
#ifndef SERVICE_HANDLER_H_
#define SERVICE_HANDLER_H_
#include <string>
#include <map>

class Services;

class Service_Handler
{
public:
Service_Handler();
virtual ~Service_Handler();
Services* getService(std::string transaction,std::string arguments);
private:
std::map<std::string,Services*> transactions;
};

#endif /*SERVICE_HANDLER_H_*/


#include "Service_Handler.h"
#include "Services.h"
#include "CreateCustomer.h"

Service_Handler::Service_Handler()
{
transactions["aaa"]=new Services;
}

Service_Handler::~Service_Handler()
{
transactions.erase("aaa");
}

Services* getService(std::string transaction,std::string arguments)
{
transactions.erase("aaa");
return NULL;
}

../Service_Handler.cpp: In function 'Services*
getService(std::string, std::string)':
../Service_Handler.cpp:17: error: 'transactions' was not declared
in this scope
!!!!!!!!!!!!
how it's possible??????????
why I can't use transactions in getService()????
please help!

You forgot the scope for getService() it is:
Service_Handler::getService(). try it!
 
V

Victor Bazarov

g said:
#ifndef SERVICE_HANDLER_H_
#define SERVICE_HANDLER_H_
#include <string>
#include <map>

class Services;

class Service_Handler
{
public:
Service_Handler();
virtual ~Service_Handler();
Services* getService(std::string transaction,std::string arguments);

I strongly recommend declaring your arguments 'std::string const &'.
private:
std::map<std::string,Services*> transactions;
};

#endif /*SERVICE_HANDLER_H_*/


#include "Service_Handler.h"
#include "Services.h"
#include "CreateCustomer.h"

Service_Handler::Service_Handler()
{
transactions["aaa"]=new Services;
}

Service_Handler::~Service_Handler()
{
transactions.erase("aaa");
}

Services* getService(std::string transaction,std::string arguments)

Did you mean

Services* Service_Handler::getService( ...

???
{
transactions.erase("aaa");
return NULL;
}

../Service_Handler.cpp: In function 'Services*
getService(std::string, std::string)':
../Service_Handler.cpp:17: error: 'transactions' was not declared
in this scope
!!!!!!!!!!!!
how it's possible??????????
why I can't use transactions in getService()????

You need to make sure you're actually defining a _member_.

Don't be too hard on yourself. Those things happen.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top