python:python_misc:oo_fundamentals_with_python
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
python:python_misc:oo_fundamentals_with_python [2018/08/20 20:15] – ↷ Page name changed from python:python_misc:python_oo_fundamentals to python:python_misc:oo_fundamentals_with_python mithat | python:python_misc:oo_fundamentals_with_python [2018/08/20 20:24] – mithat | ||
---|---|---|---|
Line 98: | Line 98: | ||
* //reset//: sets the count to zero. | * //reset//: sets the count to zero. | ||
- | Next we can think about what data we'll need to keep track of the state of a clicker-counter. In this case, it's pretty simple: all we really need is one integer to store the count value. | + | Next we can think about what data we'll need to keep track of the state of a clicker-counter. In this case, it's pretty simple: all we really need is one integer to store the //count// value. |
So, a summary of what we need so far is: | So, a summary of what we need so far is: | ||
Line 104: | Line 104: | ||
* a //click// operation | * a //click// operation | ||
* a //reset// operation | * a //reset// operation | ||
- | * an integer to store the count | + | * an integer to store the //count// |
In Python, object **attributes**, | In Python, object **attributes**, | ||
Line 126: | Line 126: | ||
</ | </ | ||
- | Class definitions follow the same header/ | + | Class definitions follow the same header/ |
- | The suite of the class definition nests additional compound statements, in this case a set of function definitions---the instance methods. | + | The suite of the class definition nests additional compound statements: function definitions |
In this class definition, we define three instance methods: '' | In this class definition, we define three instance methods: '' | ||
Line 135: | Line 135: | ||
<WRAP center round tip 80%> | <WRAP center round tip 80%> | ||
- | A common error is to forget to use '' | + | A common error is to forget to use '' |
</ | </ | ||
python/python_misc/oo_fundamentals_with_python.txt · Last modified: 2018/11/30 18:45 by mithat