Question
This implementation is for C++ I'm given this header file word.h: // Class Definition for Word class #pragma once #include #include class Word { public:
This implementation is for C++
I'm given this header file word.h:
// Class Definition for Word class #pragma once #include
class Word { public: // Constructors Word(); // Default constructor Word(std::string); // Parameterized constructor Word(const Word &); // Copy constructor Word(Word &&); // Move constructor ~Word(); // Destructor
// Accessors std::string getWord(); // Accessor for word string int getCount(); // Accessor for count integer
// Mutators void setWord(std::string); // Mutator for word string void setCount(int); // Mutator for count
// Member Operators Word& operator++(); // Pre-increment: Change count Word operator++(int); // Post-increment: Change count Word& operator=(const Word &); // Copy assignment Word& operator=(Word&&); // Move assignment bool operator==(const Word &);// Relational bool operator<(const Word &); // Relational // Friends friend std::ostream & operator << (std::ostream &, const Word &); friend std::istream & operator >> (std::istream &, Word &);
private: std::string word; int count; };
Create a file named "word.cpp" that implements the Word class declared in word.h. You will need to create: 1. The default constructor Word() 2. The parameterized constructor Word(std::string) 3. The copy constructor Word(const Word &) 4. The move constructor Word(Word &&) 5. The destructor ~Word() 6. The accessor std::string getWord() 7. The accessor int getCount() 8. The mutator void setWord(std::string) 9 The mutator void setCount(int) 10. The pre-increment operator Word& operator++() 11. The post-increment operator Word++(int) 12. The copy assignment operator Word& operator=(const Word&) 13. The move assignment operator Word& operator(Word&&) 14. The relational operator bool operator==(const Word &) 15. The relational operator bool operator<(const Word &) 16. The stream extraction operator >> 17. The stream insertion operator <<
Create the elements so that when your word.cpp file is compiled along with the UNCHANGED reference file, your program behaves identically to the reference executable file.
The executable is a wordcount program that does something like:
*reads file*
The word "Hello" occurs 1 times
The word "World!" occurs 1 times
etc...
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