views:

51

answers:

2

Hi,

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"

A: 

configuration_ = new ConfigurationInterface();

Alex Farber
But maybe ConfigurationInterface is an abstract class and Configuration inherit from it ?
Cedric H.
And maybe Configuration.h file is empty...
Alex Farber
Cedrik H. is right :)
andofor
+3  A: 

Change

const Info GetInfo()

to

const Info Service::GetInfo()
erik
That worked. Could I know what I did wrong? Thanks again :)
andofor
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