I have a weird problem, this is my code :
test.h
#ifndef _test_
#define _test_
#include <iostream>
#include <string>
class Test {
public:
Test();
~Test();
void addName(std::string _Name);
private:
std::string Name;
};
#endif // _test_
test.cpp
#include "test.h"
Test::Test() {}
Test::~Test() {}
void Test::addName(std::string _Name) {
std::cout << _Name << std::endl;
Name = _Name;
std::cout << _Name << std::endl;
}
main.cpp
#include "test.h"
int main(int argc, char* argv[]) {
Test* project;
project->addName("abc");
return 0;
}
Results :
abc
The program has unexpectedly finished.