133k views
0 votes
Class string belongs to which namespace?

A.
std

B.


C.


D.
All of the above

User Tenclea
by
7.2k points

1 Answer

2 votes

Answer:

A. std

Step-by-step explanation:

Class string belongs to std namespace. Its complete representation is std::string. Besides string, std namespace also contains other standardized objects such as cout, cin, vector etc. If we use the declaration

using namespace std in our C++ program , then we can use string datatype directly without having to prefix it with std:: in the rest of the code. This aids in readability.

User Mutsu
by
5.9k points