Encapsulation

From TRCCompSci - AQA Computer Science
Revision as of 20:13, 16 December 2016 by QuantumFluctuator (talk | contribs) (Created page with "Encapsulation is where information in one part of a program is protected from other parts of the program. This is done with key words such as "public", "private" and "protecte...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Encapsulation is where information in one part of a program is protected from other parts of the program. This is done with key words such as "public", "private" and "protected".

Public

The "public" modifier allows data to be viewed and manipulated by any part of the program.

Private

The "private" modifier means that only the class in which data is declared can it be viewed.

Protected

The "protected" modifier means that only the class in which data is declared and its subclasses can see the data.