Answers to Exercises

1.The output of the compiler should look something like this:
Error E2247 STREX1.cpp 21: 'string::m_Length' is not accessible in function main()

Warning W8004 STREX1.cpp 28: 'Length' is assigned a value that is never used in function
 main()

This one is simple; since m_Length is a private member variable of string, a nonmember function such as main can't access it. Also, the compiler is warning us that we are never using the value of the Length variable.

2.The output of the compiler should look something like this:
Error E2247 STREX2.cpp 17: 'string::string()' is not accessible in function main()

This is also pretty simple. ...

Get C++: A Dialog Programming with the C++ Standard Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.