DEV Community


Posted on

Types versus Instances, Methods versus Properties

Some of the differences between a method and a property are that a method is a function that has been defined as a part of a type and a property is the one or more pieces of associated information in an instance. A property provides a way to get or set a value for an instance. A method provides behavior specific to that instance.

The difference between a type and an instance is that types are classifications for literals, such as String, Int or Bool while instances are the specific values given to those types at any given moment.

Top comments (0)