Je suis en train de faire des hello world en C++. J'utlise Code::Blocks et GCC sous Debian, ou C::B + MinGW + GCC sous XP.
J'ai créé un projet avec un seul source, qui fait un hello world simplissime.
Un truc m'étonne.
Quand je fais :
#include <iostream> using namespace std; int main() { string Hello("Hello world!"); cout << Hello << endl ; return 0; }
Ce que je ne comprends pas : Pourquoi string est reconnu, alors que je n'ai pas inclu <string> ? On me dit qu'il faut le faire dans les tutos que je vois ?
The C++ language library provides support for strings through the standard string class. This is not a
fundamental type, but it behaves in a similar way as fundamental types do in its most basic usage.
A first difference with fundamental data types is that in order to declare and use objects (variables) of this type we
need to include an additional header file in our source code: <string> and have access to the std namespace(which we already had in all our previous programs thanks to the using namespace statement).
Le tuto est-il trop simpliste ?
Si j'ai à peu près compris comment ça marche (de loin hein, j'ai 0 prétention), je dois utiliser un constructeur surchargé de la classe string quand je fais ma déclaration/affectation ? (arrêtez-moi si j'ai dit n'importe quoi surtout

(ps -> je suis en train d'acheter un bouquin, donc logiquement, je devrais, dans quelques {semaines



