1. Computing

Definition of Accessor

By

Definition: An accessor function in C++ is like the getter and setter functions in C#. This is used instead of making a class member variable public and changing it directly within an object, It is made private and not directly accessible. To read or modify the object member, an accessor function must be called.

Typically for a member such as Level, a function GetLevel() would return the value of Level and SetLevel() to assign it a value.

 class CLevel {
 private:
 int Level;
 public:
 int GetLevel() {return Level;} ;
 	void SetLevel(int NewLevel) { Level=NewLevel;} ;
 
 };
 

Glossary:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Related Video
Create Bullet, Number, and Definition Lists in HTML
  1. About.com
  2. Computing
  3. C / C++ / C#
  4. Glossary
  5. Accessor - Definition

©2014 About.com. All rights reserved.