Hi there,
At university I learnt Fortran to an adequate level for simple programs and as I enjoyed it i looked towards trying to learn C++. Up to now its been very slow but progressing, however i seem to have hit a bit of a brick wall.
From just material on the internet I have found this one of the best and most friendly websites so was hoping to hopefully get a bit of help without looking too stupid lol.
Without going off on one im basically trying to define a string that is part of a class and then bring it into the main function for output. This may seem strange but I think it is a requirement for my program which at the end will span a fair few source files.
Anyway this is my code at present:
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
class test
{
public:
void write(std::string);
};
void test::write(std::string name)
{
name = "HELLO";
}
int main ()
{
test A;
cout << A.write(name) << endl;
return 0;
}
I am revcieving an error:
error C2065: 'name' : undeclared identifier
Do I require the use of pointers perhaps?
I hope this is enough for someone to understand.
Thank you very much in advance for your time in looking at this,
Andy