2
Reply

What is accessor and mutator?

Manas Ranjan Dash

Manas Ranjan Dash

14y
11.6k
0
Reply

    An Accessors just returns value of one of the member variables . It is a member function that accesses the contents of the object but does not modify the objects.


    A Mutator just assign a new value to one of the member variable. It is a member function that can modify an object.
    Every non-const member function are mutator.

    An accessor is a method that provide info on object. They are genrally properties which have a get method.On the other side Mutators can modify an object's state. They are the set method in a properties.