Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c++ Q7: Continue with Integer class: a) Copy the previous program to a new file. b) Overload the postfix -- operators, so return a

in c++
image text in transcribed
image text in transcribed
Q7: Continue with Integer class: a) Copy the previous program to a new file. b) Overload the postfix -- operators, so return a Word object with remove last character of value. c) Overload the pretfix -- operators, so return a Word object with remove first character of value. d) Overload the subscript i operator, terminate program if index is bigger or equal than size. Return i-th character based on the given index. Class template (complete following function): class Wordt friend Word operator-//postix friend Word operator-//preffix char& operator] } Use following main() to test your class. int main() { Word a("abc"),b; cout Answer: 7 CO 10 2.cpp 1 #include 2 using namespace std; 3 class Word { 4 private: 5 string value; 6 int size; public: Word(){value = "empty"; size = 0;} 9 Word(string val): Word(){value = val;size = val.length(); } 11 12 void setValue(string v) {value = v;} 13 string getValue() {return value; } 14 void setSize(int s){size=s;} int getSize(){return size;) }; 18 int main() { Word a,b("abc"); 21 22 cout Answer: 7 CO 10 2.cpp 1 #include 2 using namespace std; 3 class Word { 4 private: 5 string value; 6 int size; public: Word(){value = "empty"; size = 0;} 9 Word(string val): Word(){value = val;size = val.length(); } 11 12 void setValue(string v) {value = v;} 13 string getValue() {return value; } 14 void setSize(int s){size=s;} int getSize(){return size;) }; 18 int main() { Word a,b("abc"); 21 22 cout

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

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions

Question

Define observational learning.

Answered: 1 week ago