Question
C++ Assignment Note : Other chegg users Please don't copy . We have to create a FunnyNumber header, but I don't know how to proceed
C++ Assignment
Note : Other chegg users Please don't copy .
We have to create a FunnyNumber header, but I don't know how to proceed from now on, please edit my code. I have provided the Number header. In bold : what i have problem with. Thanks
Instructions:
Make a FunnyNumber.h header which extends Number.h, add two constructors to it
Add a void reverse() function and implement it.
Override operators + and == in FunnyNumber so they have a different behavior.
Here is Number.h
#ifndef NUMBER_H #define NUMBER_H #include#include #include using namespace std; class Number { public: // Make a number with value 0 Number(); // Make a number with value val Number(string val); // Get the number's value virtual string getValue() const; // Print this number to the stream virtual void print(ostream& stream) const; // Read this number from the stream virtual void read(istream& stream); // Overload the insertion operator friend ostream& operator <<(ostream& outs, const Number& n); // Overload the extraction operator friend istream& operator >> (istream& ins, Number& n); // Operator + virtual Number operator+ (const Number& other) const; // Operator == virtual bool operator== (const Number& other) const; protected: string value; }; #endif
What I tried for FunnyNumber.h:
#ifndef FUNNYNUMBER_H #define FUNNYNUMBER_H
#include
using namespace std;
class FunnyNumber : public Number { public: //constructors FunnyNumber(); FunnyNumber(string val);
// Operator + virtual string operator+(const FunnyNumber &other)const;
// Operator == virtual bool operator==(const FunnyNumber &other)const;
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