<string> in the header file

I am trying to define a variable of type string in a class definition in a header file. Is it possible? Example:

/* Foo.h */ #include <string> class Foobar{ int a; string foo; } 

Because somehow basically I can declare a string variable, but in the header it does not recognize my string type.

+6
source share
1 answer

string lives in the std . Do it:

 #include <string> class Foobar { int a; std::string foo; }; 
+24
source

Source: https://habr.com/ru/post/914563/


All Articles