I'm having a problem getting string to work in my class. I've
included the test source code, and get a missing ; before my
variable name. Then, it treats string like a variable of my class.
It works fine as a string in my main, but won't compile when trying
to use string in my class. Any ideas what I'm doing wrong?
#ifndef TEST
#define TEST
class test {
string name;
public:
test();
~test();
void entername ( void );
}
#endif
// Test.cpp
#include <iostream>
#include <string>
#include "test.h"
using namespace std;
void main ( void )
{
string hi;
int testover;
test test1;
hi = "hi";
cout << hi;
test1.entername();
cin >> testover;
}
test::test()
{
}
test::~test()
{
}
void test::entername ( void )
{
cin >> name;
cout << name;
}
Thanks,
John