Explain what are mutator methods in C++?

devquora
devquora

Posted On: Feb 22, 2018

 

While an accessor function makes a protected data member or private object accessible to an outside user, it does not give permission for editing it or modifying it in any way. Modification of a protected data member always requires calling a mutator function. Since the mutator methods provide direct access to protected data, both mutator and accessor functions must be written and used carefully by the user.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    C++ Interview Questions

    Explain what is OOP?

    Object-oriented programming (OOP) is a type of computer programming, also more commonly known as software design, in wh..

    C++ Interview Questions

    What is the difference between #import and #include in C++?

    The statement #include is used in C++ to include the source file or import the header files containing definitions of f..

    C++ Interview Questions

    What is ‘this’ pointer?

    The ‘this’ pointer is passed as a hidden argument to all the non-static member method calls and is available as a l..