Question: Help please!! Given the following code: class DataStorer { short data: public: //..... DataStorer operator++(int) { (DataStorer temp(data): ++data: return temp: } Explain what is
Given the following code: class DataStorer { short data: public: //..... DataStorer operator++(int) { (DataStorer temp(data): ++data: return temp: } Explain what is going on in the code. In your discussion, be sure to answer the following questions: i) What's that unnamed int argument? ii) Why's the function defined inside the class definition? iii) Does this class do anything useful? iv) Is there anything wrong with this code? Declare an object of this class type and show how a programmer would normally call the given operator. The data type of a file stream is either ifstream or ofstream (defined in the _____ library). However, when passing a file stream to a function, we normally use the data types ____ and _____ respectively. This is because it provides compatibility with the console streams (letting the one function work with both _____ and an input file depending on what actual argument is passed). However, when using ______ or methods, the file stream must be passed through an ifstream or ofstream argument. (After all, who would want to do those actions to the a console?) No matter which types you choose, streams must always be passed as _____ arguments because no matter what you do to a stream, you are changing it in some way TRUE/FALSE Function object classes can contain data members state remember 'state' between calls. TRUE/FALSE Function object classes can overload operator() multiple times for different reasons. TRUE/FALSE Function object classes passed to functions by template arguments may need to have mutable data members to work properly TRUE/FALSE A function object is so named because it is an object that can be used just as if it wore a function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
