-2

In my Service.h I have:

#include "Configuration.h"

and in my class:

private:
ConfigurationInterface* configuration_;

Then, in my Service.cpp:

Service::Service(Foundation::Framework* framework) : 
        framework_(framework)
    {

  configuration_ = new Configuration();
    }

and later...

 const Info GetInfo()
 {
  return configuration_->getInfo();
 }

I get undeclared identifier error.... (configuration_)

Why¿?

EDIT: As Cedric H. said: "ConfigurationInterface is an abstract class and Configuration inherit from it"

legami
  • 1,303
  • 6
  • 22
  • 31

2 Answers2

3

Change

const Info GetInfo()

to

const Info Service::GetInfo()
erik
  • 1,238
  • 3
  • 12
  • 23
  • Without the class qualification on the function the compiler thinks this is a global function rather than a class member function, and therefore it has no idea what configuration_ is supposed to be. – Steve Townsend Sep 01 '10 at 11:28
0

configuration_ = new ConfigurationInterface();

Alex F
  • 42,307
  • 41
  • 144
  • 212