List of all available Websheets
Viewing cpp/cs104/classes/this_scope by redekopp@usc.edu. You have unsaved changes. Log in above to create, edit, preview and publish Websheets.
Property | Value |
---|---|
Description html markup shown to student | Examine the <tt>setValue()</tt> function below. What is wrong with it? <p> Fix it by preceding the data member with <tt>this-></tt> |
Engine | |
Template / Reference solution |
using namespace std; class Item { public: void setValue(int value); int getValue() const { return value; } private: int value; }; void Item::setValue(int value) { \[ REDACTED \show: value = value; ]\ } int main() { Item x; x.setValue(2); // Now print out the value...expecting 2 cout << x.getValue() << endl; return 0; }
|
C++ test suite json list of stdin/args tests e.g. [{"stdin":"hi", "args":["4", "5"]}, {"stdin":"noargs"}] to just run once with no input use [{}] | [{}] |
Is example? i.e., just a demo | |
Remove default compiler flag(s) | ["-Wno-shadow", "-Wno-self-assign"] |
Note: problems are open-source by default (see 'Public permissions'). Assumed license for open problems is Creative Commons 4.0 Attribution-ShareAlike unless specified in 'Remarks'.