I have this code:
#include <iostream>
#include <string>
#include <map>
namespace Test
{
class Storage
{
public:
static std::map<std::string, std::string> storageMemory;
static void Set(std::string name, std::string value)
{
if (name.length() == 0 && value.length() == 0) {
return;
}
storageMemory[name] = value;
}
static std::string Get(std::string name)
{
return storageMemory[name];
}
};
}
My idea:
Test::Storage::Set("key", "value"); // to set value
Test::Storage::Get("key"); // to get value by key
Have any ideas?
Why this construction not works?
For example when I create this logic in PHP this working fine.
Help me please!
Thanks!