Accessors and Modifiers - Research Article from World of Computer Science

This encyclopedia article consists of approximately 1 page of information about Accessors and Modifiers.
Encyclopedia Article

Accessors and Modifiers - Research Article from World of Computer Science

This encyclopedia article consists of approximately 1 page of information about Accessors and Modifiers.
This section contains 268 words
(approx. 1 page at 300 words per page)

Accessors and modifiers are operations in object-oriented programming that read or modify some property of an object. Accordingly, operations that function as accessors and modifiers are designed to read or modify variables in a software bundle that generally affect the state and behavior of an object.

Accessors do not change the state of the object. Read access is an example of an accessor operation. An accessor method returns, or displays, the value of a data member. Accessors do not use parameters and they are designed to remove the need for client programs to directly access data or to provide read-only access to data. Accessors representing values take the place of the data in calculation or output operations.

Modifiers allow changes to the state of an object variable. Modifications are, however, designed to prevent changes in data relationships (maintain integrity) by a particular function. Such protection is important because changes to the value of a data member are often critical. For example, if a bug is introduced during the modification operation, than the data can become corrupted and the program can cease to function. There are many types of such corruption errors, but in common among such errors is a loss of continuity in either the reading of program instructions or an introduced corruption of data type (a change in data format that is incompatible with the operation). In contrast to accessors, modifiers do not return values.

Accessors and modifiers are both member function types, along with constructors and destructors. Generally, they permit the sole direct access by a user to a class.

This section contains 268 words
(approx. 1 page at 300 words per page)
Copyrights
Gale
Accessors and Modifiers from Gale. ©2005-2006 Thomson Gale, a part of the Thomson Corporation. All rights reserved.