CSE 143, Summer 2000 Midterm 1 Programming Problem, Sample Solution 18. MINDREADING PROBLEM (worth 3 multiple choice questions) Here is the implementation of a method of a certain class. Assume that this method is correct and uses no global variables or constants of any kind. Write a class declaration that shows as much as you can reasonably deduce about the class, just from this code. Assume the author follows a style guideline similar to the one used in this course. bool Browser::updateNodeCount(int urlIndex) { Browser tempBrowser(5, 475.33); bool result; tempBrowser.setIndex(&result, urlIndex); nodes = 1 + tempBrowser.nodeCount(); return result; } // sample solution class Browser { public: // Strictly speaking, there isn't necessarily a default // constructor, but it's likely. Browser(); // Parameter names are arbitrary. Browser(int n, double x); // We assume these methods are public, though that's not // necessarily the case. // obvious from the given definition bool updateNodeCount(int urlIndex); // Void return type is assumed, but not necessarily the // case. Note that result's type is bool *, not bool &. void setIndex(bool *r, int i); // int is most likely return type, given expression 1 + // tempBrowser.nodeCount() above int nodeCount(); private: // Member variables tend to be private in well-designed // classes, so nodes is declared here, not above. // most likely type, given expression 1 + // tempBrowser.nodeCount() above int nodes; };