Created
May 29, 2013 12:11
-
-
Save mutoo/5669833 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class IntCell | |
| { | |
| public: | |
| explicit IntCell(int initialValue = 0) | |
| :storedValue(initialValue) {} | |
| int read() const {return storedValue;} | |
| void write(int x) {storedValue = x;} | |
| private: | |
| int storedValue; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class IntCell | |
| { | |
| public: | |
| IntCell(int initialValue = 0) | |
| :storedValue(initialValue) {} | |
| int read() const {return storedValue;} | |
| void write(int x) {storedValue = x;} | |
| private: | |
| int storedValue; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include "IntCell.h" | |
| int main(int argc, const char * argv[]) | |
| { | |
| IntCell a; | |
| a = 13; | |
| std::cout << a.read(); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment