- A method is to a function is as a variable is to a Property...
Such as you can assign a value to a variable you can also do the same for a property, but instead when you get or set a value within a property it is part of an instance. Instances can have different values within each property. Methods can be repeated and provides behavior specific to each instance, such as functions.
A function is useful for providing behavior that can be repeated as needed. A method works in the same way, providing behavior specific to that instance.
- What is the difference between a type and an instance? A Type is a String and an instance is the result of this type.
Top comments (0)