Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Update the member function theValue() of SuperInt class so that SuperInt can be put on the left hand side of an assignment statement using

C++

Update the member function theValue() of SuperInt class so that SuperInt can be put on the left hand side of an assignment statement using theValue(). Create a new class "SuperSuperInt," which inherits the "SuperInt" class. Please declare and define this class in separate .h and .cpp files, and DO NOT update SuperInt.h and SuperInt.cpp directly. Please name your new files as "SuperSuperInt.cpp" and "SuperSuperInt.h." Add one member function theValue() to SuperSuperInt. Code the member function theValue() of SuperSuperInt to return the value of data member "myValue" in SuperInt. Please make sure the returned value of theValue() CANNOT be put on the left hand side of an assignment statement

image text in transcribedimage text in transcribed

Super Int.h * This is a class that acts like an int, but outputs various useful stuff. You can add to this to experiment! Created by Michael Stiber Modified by Yang Peng on 01/12/18 #include class Super Int { public: 1/ Name helps us see which variable SuperInt(int init, const char *name); SuperInt(); // For demonstrating lvalues //int& theValue(void); const int& theValue(void); private int myValue; std::string my Name; // Neat trick: making this private prevents creating unitialized // objects SuperInt(); Super Int.cpp * This is a class that acts like an int, but outputs various useful stuff. You can add to this to experiment! Created by Michael Stiber * Modified by Yang Peng on 01/12/18 #include #include "Super Int.h" using namespace std; 1/ Name helps us see which variable SuperInt: : SuperInt(int init, const char *name): myValue(init), my Name (name) cout class Super Int { public: 1/ Name helps us see which variable SuperInt(int init, const char *name); SuperInt(); // For demonstrating lvalues //int& theValue(void); const int& theValue(void); private int myValue; std::string my Name; // Neat trick: making this private prevents creating unitialized // objects SuperInt(); Super Int.cpp * This is a class that acts like an int, but outputs various useful stuff. You can add to this to experiment! Created by Michael Stiber * Modified by Yang Peng on 01/12/18 #include #include "Super Int.h" using namespace std; 1/ Name helps us see which variable SuperInt: : SuperInt(int init, const char *name): myValue(init), my Name (name) 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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

b. Where did they come from?

Answered: 1 week ago