Encapsulate Field
   HOME





Encapsulate Field
In computer programming, field encapsulation involves providing Method (computer science), methods that can be used to read from or write to the Field (computer science), field rather than accessing the field directly. Sometimes these Mutator method, accessor methods are called ''getX'' and ''setX'' (where X is the field's name), which are also known as mutator methods. Usually the accessor methods have public visibility while the field being encapsulated is given Variable (programming)#Scope and extent, private visibility - this allows a programmer to restrict what actions another user of the code can perform. Compare the following Java (programming language), Java Class (computer science), class in which the ''name'' field has not been encapsulated: public class NormalFieldClass with the same example using encapsulation: public class EncapsulatedFieldClass In the first example a user is free to use the public ''name'' variable however they see fit - in the second however ...
[...More Info...]      
[...Related Items...]     OR:     [Wikipedia]   [Google]   [Baidu]  


picture info

Computer Programming
Computer programming or coding is the composition of sequences of instructions, called computer program, programs, that computers can follow to perform tasks. It involves designing and implementing algorithms, step-by-step specifications of procedures, by writing source code, code in one or more programming languages. Programmers typically use high-level programming languages that are more easily intelligible to humans than machine code, which is directly executed by the central processing unit. Proficient programming usually requires expertise in several different subjects, including knowledge of the Domain (software engineering), application domain, details of programming languages and generic code library (computing), libraries, specialized algorithms, and Logic#Formal logic, formal logic. Auxiliary tasks accompanying and related to programming include Requirements analysis, analyzing requirements, Software testing, testing, debugging (investigating and fixing problems), imple ...
[...More Info...]      
[...Related Items...]     OR:     [Wikipedia]   [Google]   [Baidu]  



MORE