Question
39 . Which of the following is true about the library string class or the textbook example String class? Group of answer choices The class
39. Which of the following is true about the library string class or the textbook example String class?
Group of answer choices
The class interface contains a character array data member to hold the string
All of these
If the character array overflows, the class copy constructor creates linked list with another char array to hold the additional characters
The class interface contains a character pointer to the string
40.Which line of code will complete the constructor from the textbook example String class?
class String { public: String(); // Default constructor String(const char s[]) { len = strlen(s); if (len > 0) { _____________________________//line of code goes here for (int i = 0; i < len; i++) { buffer[i] = s[i]; } } else { buffer = nullptr; } } private: char* buffer; int len; };
Group of answer choices
char buffer[len];
char buffer[len+1];
buffer = new char[len];
char* buffer = new char[len];
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started