ANSWER BANK Move the necessanry blocks over into the response area: delete () temp; char" temp- this->value; strcat(this->value, rightObj.c_str()); return this; this->max_length - newlen; H// Concatenation assignment operator for StringVar class. i if (this =- &rightobj) return *this; I #include strcpy(this->value, temp); I StringVar& StringVar::operator - (const StringVar& rightobj) { if (this->max_length < newlen) { i this->value[@] ▪ '\®*; I #include "StringVar.h" this->value - new char[this->max_length+1]; int newlen = length()+right0bj.length(); this->value nullptr;

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

c++

Assume that StringVar.h has the following declaration:
#include siostream>
class stringvar {
public:
stringvar() : max_length(28) {
value = new char[max_length+1];
value[0] = '\e";
// Default constructor size is 20
stringvar(int size);
// Takes an int for size
stringvar(const char cstr[]);
// Takes a c-string and copies it
stringvar(const stringvar& strobj);
// Copy Constructor
-stringvar();
// Destructor
int size() const { return max_length; }
// Access capacity
const char* c_str() const { return value; } // Access value
int length() const { return strlen(value); } // Access length
stringvar& operator= (const stringvar& rightobj);
stringvar& operator+= (const stringvar& rightobj);
std::istream& operator>> (std::istream& in, stringvar& strvar);
std::ostreame operator<« (std::ostream& out, const stringvar& strvar);
private:
int max_length;
char value;
};
Transcribed Image Text:Assume that StringVar.h has the following declaration: #include siostream> class stringvar { public: stringvar() : max_length(28) { value = new char[max_length+1]; value[0] = '\e"; // Default constructor size is 20 stringvar(int size); // Takes an int for size stringvar(const char cstr[]); // Takes a c-string and copies it stringvar(const stringvar& strobj); // Copy Constructor -stringvar(); // Destructor int size() const { return max_length; } // Access capacity const char* c_str() const { return value; } // Access value int length() const { return strlen(value); } // Access length stringvar& operator= (const stringvar& rightobj); stringvar& operator+= (const stringvar& rightobj); std::istream& operator>> (std::istream& in, stringvar& strvar); std::ostreame operator<« (std::ostream& out, const stringvar& strvar); private: int max_length; char value; };
RESPONSE AREA
Organize answer blocks in the proper order:
ANSWER BANK
Move the necessary blocks over into the response area:
delete [] temp;
char* temp = this->value;
strcat(this->value, rightobj.c_str());
return *this;
this->max_length = newlen;
# // Concatenation assignment operator= for StringVar class.
}
# if (this == &right0bj) return *this;
10
# #include <cstring>
11
strcpy (this->value, temp);
12
# StringVar& StringVar::operator += (const StringVar& rightObj) {
13
if (this->max_length < newlen) {
14
# this->value[0] = '\0';
# #include "StringVar.h"
this->value = new char[this->max_length+1];
int newlen = length()+rightObj.length();
this->value = nullptr;
Transcribed Image Text:RESPONSE AREA Organize answer blocks in the proper order: ANSWER BANK Move the necessary blocks over into the response area: delete [] temp; char* temp = this->value; strcat(this->value, rightobj.c_str()); return *this; this->max_length = newlen; # // Concatenation assignment operator= for StringVar class. } # if (this == &right0bj) return *this; 10 # #include <cstring> 11 strcpy (this->value, temp); 12 # StringVar& StringVar::operator += (const StringVar& rightObj) { 13 if (this->max_length < newlen) { 14 # this->value[0] = '\0'; # #include "StringVar.h" this->value = new char[this->max_length+1]; int newlen = length()+rightObj.length(); this->value = nullptr;
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education