In a variety of object-oriented programming languages, property is a member of the class that provides the procedures for operating on a data member of that class. Properties provide a higher level of encapsulation compared to public fields. Properties are intermediate between member code (methods) and member data (instance variables) of the class.
Programming languages that support properies include Delphi (programming language), Visual Basic and C#. Some object-oriented languages, such as C++ and Java, don't support properties, and require the programmer to define a pair of accessor and mutator methods instead.
In most languages, properties are implemented as a pair of accessor/mutator methods, but accessed using the same syntax as for public fields. Omitting a method from the pair yields a read-only or write-only property, the latter being rather uncommon.
In some languages with no built-in support for properties, a similar construct can be implemented as a single method that either returns or changes the underlying data, depending on the context of its invocation. Such techniques are used e.g. in Perl.
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Property (programming)".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world