Objects Have Methods

Learn the need for defining methods of an object.

We'll cover the following

Methods

Methods are an object’s behavior.Objects have methods, allowing us to do interesting stuff with them. An object’s methods are things that the object can do.

Think about a person, like a friend. We can ask this person for their name (call a method), and they’ll tell us (return it to us). Their name is a piece of knowledge that this person has, and the ability to tell it to us (respond to our question) is a behavior (method) they have.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy