Codele / How software is built
Objects and classes
A class is a blueprint, like a cookie cutter. An object is one thing made from it, like a cookie, with its own data and its own actions.
- A class is a blueprint: it says what data every object has and what actions it can do.
- An object is one thing made from the class. It has its own copy of the data.
- A method is an action an object can do, such as deposit. It works on that object’s own data. Python writes self and JavaScript or Java write this for “this very object”.
- The constructor is the setup code that runs when an object is made.
Loading the playable lesson…