I was working with xemacs in unix. One of my c++ class header file has a string variable. E.g.:

document.h:
Code:
#ifndef DOC_H
#define DOC_H

#include <string>
using std::string;

class Document
{
public:
/* ... */ 
private:
String name;
};

#endif
Notice the #include <string>. I had to place that or else the compiler doesnt recognize the string variable. Why is it so? I never had to do that in VC++. Can't i just include the string header before this header file in the implementation file?

E.g:
document.cpp:

Code:
#include <iostream>
#include <string>
#include "document.h"

using namespace std;

/*.........Implementations of class document....*/