I created following classes in my program.
Way.h
class Way {
private:
std::string id;
std::string name;
public:
Way();
Way(const Way& orig);
void SetName(std::string name) { this->name = name; }
std::string const & GetName() const { return name; }
void SetId(std::string id) { this->id = id; }
std::string const & GetId() const { return id; }
};
way.cpp
#include "Way.h"
Way::Way() {
}
Way::Way(const Way& orig) {
}
AreaDataRepository.h
class AreaDataRepository {
private:
Way onGoingWay;
public:
AreaDataRepository();
AreaDataRepository(const AreaDataRepository& orig);
~AreaDataRepository();
static AreaDataRepository & Instance()
{
static AreaDataRepository singleton;
return singleton;
}
void SetOnGoingWay(Way onGoingWay) { this->onGoingWay = onGoingWay; }
Way const & GetOnGoingWay() const { return onGoingWay; }
};
AreaDataRepository.cpp
#include "AreaDataRepository.h"
#include "../common/Common.h"
AreaDataRepository::AreaDataRepository() {
}
AreaDataRepository::AreaDataRepository(const AreaDataRepository& orig) {
}
AreaDataRepository::~AreaDataRepository() {
}
in program main method
Way wayNode
wayNode.SetId("1234");
wayNode.SetName("jan");
AreaDataRepository::Instance().SetOnGoingWay(wayNode);
std::cout<<"Id ->>>>>>>>>>>>>" <<AreaDataRepository::Instance().GetOnGoingWay().GetId() << std::endl;
std::cout<<"Name ->>>>>>>>>>>>>" <<AreaDataRepository::Instance().GetOnGoingWay().GetName() << std::endl;
but this print nothing and i try to debug and get the values, vales are empty for OnGoingWay.
I need some help to sort out this.
thanks in advance!