--%>

Explain Mutator method

Mutator method: It is a method specifically designed to permit controlled modification of a private attribute of a class. By convention, we name the mutators with a set prefix obeyed by the name of the attribute being transformed. For example, the mutator for an attribute named speed would be setSpeed. By creating an attribute private, we save objects of other classes from modifying its value other than via its mutator. The mutator is capable to check the value being employed to transform the attribute and reject the modification when essential. Moreover, modification of one attribute may need others to be transformed in order to keep the object in a reliable state. A mutator technique can undertake this role. Mutators are employed both to grant safe access to the value of the private attribute and to save attributes from modification by objects of the other classes. The later goal is accomplished by selecting a suitable visibility for the mutator.

   Related Questions in Programming Languages

  • Q : Define the term Heterogeneous collection

    Define the term Heterogeneous collection: It is a collection of objects with distinct dynamic types

  • Q : System Architecture for Windows

    Tell me about the System Architecture for Windows Programming?

  • Q : Explain If statement If statement : A

    If statement: A control structure employed to select between performing or not performing additional actions.     if(boolean-expression){        // Statements

  • Q : Define the term Top level class Define

    Define the term Top level class: It is a class defined either at outermost level of a package or the static nested class.

  • Q : Limit the Use of Pre-processor

    Limit the Use of Pre-processor Directives: The C pre-processor is powerful, but unrestricted use of it can lead to code that is hard to understand and analyze. Limit its use to inclusion of header files and simple macro definitions. Avoid features suc

  • Q : Explain Semantic error Semantic error:

    Semantic error: It is an error in the meaning of program. A statement might contain no syntax errors, however might still break the rules of Java language. For example, when ivar is an int variable, the shown statement is syntactically correct

  • Q : Describe tri-state devices Describe the

    Describe the tri-state devices and explain why they are necessary in a bus oriented system?

  • Q : Public class in java Q. Explain the

    Q. Explain the concept of public classes in java. How they are useful? 

  • Q : What is BLAST in program model checking

    What is BLAST in program model checking: The abbreviation is Berkeley Lazy Abstraction Software Verification Tool (BLAST) is a software model checker for C programs. The main goal of BLAST (BLAST website) is to be able to check that software satisfies

  • Q : Difference between collection and arrays

    Write the difference between collection and arrays?