I am new to the standard class string and pointer. What I am trying to do is using a string pointer to pass a string in to a constructor. But it doesn't work. It seem that the linker regards 'string*' as 'string' and '*' seperately. I am not very good at Eng so I am not sure. Could you kind guys help me find out where I made mistake,plz? Thx.
Thank u for replying. But I think whether returning a value to OS from main function dose not make any difference here. Because I have been making main() return nothing in small console apps for months.
Actually,there are three files in my project, one header file which including the declaration of class, one cpp file which is the implement of header file and the main.cpp file.
Here are the full version of header file and constructor implement:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#ifndef LC_H_H
#define LC_H_H
class LC
{
public:
LC();
LC(string*);
void CountWords();
void CountLetter();
friend ostream& operator<<(ostream&,const LC&);
private:
string line;
int word;
int count[26];
};
#endif