compiler madness??

Discussion in 'C++' started by g, Mar 4, 2006.

  1. g

    g Guest

    #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!
    g, Mar 4, 2006
    #1
    1. Advertising

  2. g

    Uwe Grawert Guest

    g wrote:
    > #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!
    Uwe Grawert, Mar 4, 2006
    #2
    1. Advertising

  3. g wrote:
    > #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
    --
    Please remove capital As from my address when replying by mail
    Victor Bazarov, Mar 4, 2006
    #3
  4. g

    g Guest

    Ohhhh my god!!!!!!!!
    I dont believe it.......so stupid:)

    thanks a lot!
    g, Mar 4, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Todd

    Session Variable Madness

    Todd, Jan 21, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    421
  2. V. Jenks

    RadioButtonList madness!

    V. Jenks, Apr 19, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    460
    Ashish M Bhonkiya
    Apr 19, 2004
  3. =?Utf-8?B?QUNhdW50ZXI=?=

    Audio Madness @#!#@

    =?Utf-8?B?QUNhdW50ZXI=?=, Feb 26, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    383
    =?Utf-8?B?QUNhdW50ZXI=?=
    Feb 26, 2005
  4. Mr Newbie

    Session Madness

    Mr Newbie, Nov 12, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    397
    Kevin Spencer
    Nov 13, 2005
  5. Marius Horak

    Madness, I call it madness

    Marius Horak, Jun 4, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    157
    Raterus
    Jun 4, 2004
Loading...

Share This Page