Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IF YOU JUST COPY AND PASTE YOUR ANSWER FROM ANOTHER QUESTION YOU'LL ONLY GET A DOWNVOTE. Object-Oriented Programming C++ - Class called PFAString with these

IF YOU JUST COPY AND PASTE YOUR ANSWER FROM ANOTHER QUESTION YOU'LL ONLY GET A DOWNVOTE. Object-Oriented Programming C++ - Class called PFAString with these requirements. Please read everything and make sure they are according to the requirements listed. READ NOTE AT THE END OF POST

image text in transcribed

Provided guide:

PFAString.hpp

#ifndef PFASTRING_HPP #define PFASTRING_HPP

#include

class PFAString { public: Default constructor Constructor that sets capacity ONLY Constructor that sets capacity and initializes all elements to a specific string // If no string is provided, then a null string will be used. This is a single constructor (no overloads for this case) Copy Constructor // 1st type only (Refer to list of vector constructors on cplusplus.com) Move Constructor // 1st type only Destructor function capacity function size function push_back // Places a string at the back of the array, l-value version only function pop_back // Destroys the string at the back of the array function resize // Grows or shrinks array accordingly, must behave like vector resize() function function empty_array // Sets the size to zero overload operator [] // Needs to work as l-value overload copy operator = overload move operator = overload operator == overload operator != overload operator overload operator >= private: std::string *arr; int _capacity; // Capacity and size are two different things int _size; };

#endif

END CODE

NOTE: Be sure to please to the move constructor and move assignment operator. If anything, do those first; I really only need those two done I think. I'll be sure to give an upvote.

. Use the provided file PFAString.hpp as a guide. Do NOT change the name of the header file. The name of your implementation file shall be PFAString.cpp NOTE: The header file is an outline, and you are required to flesh it out (const where needed, etc.) The provided header file is a base to work on. Nothing should be removed, function names should not be changed, but you are free to add private helper functions and additional functions and member variables as you see fit The copy constructor should construct the new object to have a capaciy equal to the size of the object being copied The same holds true for the copy operator overload of The overloaded [] should be written so that it can function as an l-value For the relational overloads, the comparison should be lexicographical NOTE: You are NOT allowed to use the lexicographical.compare algorithm http://www.cplusplus.com/reference/vector/vector/operators/ http://www.cplusplus.com/reference/algorithm/lexicographical-compare/ Reading these resources will save you a lot of unnecessary work When the array is expanded, it MUST expand to twice its previous capacity. L.E., an array of capacity 20 will expand to capacity 40 when an attempt to add a 21st element occurs For further clarification, read about the equivalent function in the class on either cplusplus. com or cppreference.com . Use the provided file PFAString.hpp as a guide. Do NOT change the name of the header file. The name of your implementation file shall be PFAString.cpp NOTE: The header file is an outline, and you are required to flesh it out (const where needed, etc.) The provided header file is a base to work on. Nothing should be removed, function names should not be changed, but you are free to add private helper functions and additional functions and member variables as you see fit The copy constructor should construct the new object to have a capaciy equal to the size of the object being copied The same holds true for the copy operator overload of The overloaded [] should be written so that it can function as an l-value For the relational overloads, the comparison should be lexicographical NOTE: You are NOT allowed to use the lexicographical.compare algorithm http://www.cplusplus.com/reference/vector/vector/operators/ http://www.cplusplus.com/reference/algorithm/lexicographical-compare/ Reading these resources will save you a lot of unnecessary work When the array is expanded, it MUST expand to twice its previous capacity. L.E., an array of capacity 20 will expand to capacity 40 when an attempt to add a 21st element occurs For further clarification, read about the equivalent function in the class on either cplusplus. com or cppreference.com

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Question 7 Draw all the resonance structures of the following: (9)

Answered: 1 week ago