Link to home
Start Free TrialLog in
Avatar of pele4483
pele4483

asked on

can't use strings in my header file

can't use strings in my class header file , if a try adding a string as private or public compiler generates some wierd error. using visual studio 2005.
#include <string>    

class Song
{
public:
            char* Get_Playing_Time();

          bool Equals(Song);
          Song(); // constructor
          Song(char * titlein, char* artist,char*album,Categorys cat,int min, int secs);
private :
      char temp[40];
string test;   // errors on this line
};
ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What I mean is while using stl string header
Avatar of pele4483
pele4483

ASKER

I KEEP FORGETTING ABOUT NAMESPACE
>> string test; rather than std::string test;

There's 3 ways to do this :

1) std::string

2) using std::string;
    string

3) using namespace std;
    string

in order or preference. The problem with the last option is that the whole namespace is loaded which can add a lot of unnecessary code to your executable.