Ello. The strings in this vector say null everytime i run it.
entity.h
#include <vector>
#include <string>
using namespace std;
class Hero
{
public:
vector<string> storage;
void addStorageItem(string);
};
entity.cpp
#include "entity.h"
Hero::Hero()
{
}
Hero::~Hero()
{
}
void Hero::addStorageItem(string x)
{
storage.push_back(x);
}
main()
#include <stdio.h>
#include <conio.h>
#include "entity.h"
int main()
{
Hero myHero = Hero();
myHero.addStorageItem("Hi");
myHero.addStorageItem("How are you");
for(int i = 0; i < myHero.storage.size(); i++)
{
printf("item Name: %s\n", myHero.storage[i]);
}
getch();
return 0;
}