About Properties

A property, like a field, defines an attribute of an object. But while a field is merely a storage location whose contents can be examined and changed, a property associates specific actions with reading or modifying its data. Properties provide control over access to an object's attributes, and they allow attributes to be computed.

The declaration of a property specifies a name and a type, and includes at least one access specifier. The syntax of a property declaration is property propertyName[indexes]: type index integerConstant specifiers; where

  • propertyName is any valid identifier.
  • indexes] is optional and is a sequence of parameter declarations separated by semicolons. Each parameter declaration has the form identifierl, ..., identifiern: type. For more information, see Array Properties, below.
  • type must be a predefined or previously declared type identifier. That is, property declarations like property Num: 0..9 ... are invalid.
  • the index integerConstant clause is optional. For more information, see Index Specifiers, below.
  • specifiers is a sequence of read, write, stored, default (or nodefault), and implements specifiers. Every property declaration must have at least one read or write specifier.

Properties are defined by their access specifiers. Unlike fields, properties cannot be passed as var parameters, nor can the @ operator be applied to a property. The reason is that a property doesn't necessarily exist in memory. It could, for instance, have a read method that retrieves a value from a database or generates a random value.

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook

Post a comment