Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is meant by planning or define planning?

Answered: 1 week ago

Question

Define span of management or define span of control ?

Answered: 1 week ago

Question

What is meant by formal organisation ?

Answered: 1 week ago

Question

What is meant by staff authority ?

Answered: 1 week ago