...

/

Objects Have Methods

Objects Have Methods

Learn the need for defining methods of an object.

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 ...