Search code examples
language-agnosticpropertiesinstance-variablesglossary

What is the difference between a property and an instance variable?


I think I've been using these terms interchangably / wrongly!


Solution

  • Iain, this is basically a terminology question and is, despite the "language-agnostic" tag associated with this question, very language/environment related.

    For design discussions sake, property and instance variable can be used interchangeably, since the idea is that a property is a data item describing an object.

    When talking about a specific language these two can be different. For example, in C# a property is actually a function that returns an object, while an instance variable is a non-static member variable of a class.