--%>

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 : What is an Attribute Attribute : It is

    Attribute: It is a particular usage of an instance variable. The set of attribute values held in a specific instance of a class state the current state of that instance. A class definition might impose specific constraints on the valid states of its i

  • Q : What is Pattern Pattern : It is a

    Pattern: It is a recurring theme in class usage or design. Interfaces like Iterator encapsulate a pattern of admission to the items in a collection, whereas freeing the client from the requirement to know details of the way in which the collection is

  • Q : Define the term Base case Define the

    Define the term Base case: It is a non-recursive route via a recursive method.

  • Q : Non linear dynamic model equation to

    Could you please show the steps from non linear dynamic model equation to linear equation?

  • Q : Learning File system with operations

    Program 1. Purpose of this assignment is to learn to work with files.Assignment: The file, data.txt, is provided on the class website. Each line of the file consists of a binary operator followed by two operands. Your program wi

  • Q : Calculate the summation of 1 to some

    Write two programs to calculate the summation of 1 to some integer n using a function called int summation(int n) a) Using a non recursive solution, with a for(i=1, i<=n; i++) loop and b) using a recursive solution, based on the following conditions summation(n) = summation(n-1

  • Q : Define Parallel programming Parallel

    Parallel programming or parrelel computing is the concurrent use of multiple compute resources to resolve a specified problem. Parallel program always comprises of concurrently executing processes, problem decomposition relates to the manner in which

  • Q : Explain Connection handshake Connection

    Connection handshake: It is the exchange of messages among two processes in an attempt to create a connection between them.

  • Q : Is a XML replacing HTML Is a XML

    Is a XML replacing HTML?

  • Q : Explain Upcast Upcast: It is a cast

    Upcast: It is a cast towards an object's ultimate super type - which is, `up' the inheritance hierarchy towards the Object class, for example:         // Upcast from VariableContr