Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Specifications for the arizona::string class public: Declare the default constructor Declare parameterized constructor that accepts a std::string variable which sets the private std::string variable Declare

Specifications for the arizona::string class public: Declare the default constructor Declare parameterized constructor that accepts a std::string variable which sets the private std::string variable Declare function to return the private std::string variable. Accepts no input check that the private variable has been set. If it has not, print "ERROR: arizona::string uninitialized (test will check for this exact string). Declare function to return a the flipped string stored in the private variable. Accepts no input Declare - (minus) operator to set the private string value Declare ~ (tilde) operator to return the size of the string (an integer value) Declare function to clear the data member, i.e., sets back to the default value. Returns nothing and accepts nothing private: Declare the string (from std) that is stored Declare function to return a flipped string. Returns a std::string variable that is the flipped string of what is stored in the private variable. Accepts no input. Sample code: #include "string.hpp" #include "stringTests.hpp" #include int main(int argc, const char * argv[]) { // Program to illustrate operator overloading and // namespaces // Declare the string object we created std::string test = "I am fast. To give you a reference point I am somewhere between a snake and a mongoose And a panther - Dwight K. Schrute"; arizona::string s(test); std::cout << s.getString() << std::endl; arizona::string s2; s2 - test; std::cout << s2.getFlippedString() << std::endl; std::cout << ~s2 << std::endl; s2.destroy(); std::cout << s2.getString() << std::endl; return EXIT_SUCCESS; } Sample output: I am fast. To give you a reference point I am somewhere between a snake and a mongoose... And a panther - Dwight K. Schrute eturhcS .K thgiwD - rehtnap a dnA ...esoognom a dna ekans a neewteb erehwemos ma I tniop ecnerefer a uoy evig oT .tsaf ma I 123 ERROR: arizona::string uninitialized Hint: How to reverse a string (where s and sFlipped are both std::string variables) for (int i = int(s.size()) - 1; i >= 0; i--){ sFlipped.push_back(s.at(i)); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Have I incorporated my research into my outline effectively?

Answered: 1 week ago