Skip to main content

3 docs tagged with "methods"

View all tags

Defining Classes: Attributes and Methods

In the last article, we learned that a class is a blueprint and an object is the instance we create from it. We used the init() method to set up the initial data, or attributes, of an object.

Instance, Class, and Static Methods

We've learned how to define methods—functions inside a class—that give our objects behavior. So far, all the methods we've created have been instance methods, which operate on a specific instance of a class.