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,Category s cat,int min, int secs);
private :
char temp[40];
string test; // errors on this line
};
#include <string>
class Song
{
public:
char* Get_Playing_Time();
bool Equals(Song);
Song(); // constructor
Song(char * titlein, char* artist,char*album,Category
private :
char temp[40];
string test; // errors on this line
};
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What I mean is while using stl string header
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.
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.