Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 787
Iain Avatar asked May 01 '09 13:05

Iain


1 Answers

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.

like image 183
Hershi Avatar answered Sep 26 '22 02:09

Hershi