explicit constructor the intcell constructor is explicit you should make all one-parameter constructors explicit to avoid behind-the-scenes type conversions otherwisethere are somewhat lenient rules that will allow type conversions without explicit casting operations usuallythis is unwanted behavior that destroys strong typing and can lead to hard-to-find bugs as an exampleconsider the followingintcell objobj /obj is an intcell /should not compiletype mismatch the code fragment above constructs an intcell object obj and then performs an assignment statement but the assignment statement should not workbecause the right-hand side of the assignment operator is not another intcell obj' write method should have been used instead howeverc+has lenient rules normallya one-parameter constructor defines an implicit type conversionin which temporary object is created that makes an assignment (or parameter to functioncompatible in this casethe compiler would attempt to convert obj /should not compiletype mismatch into intcell temporary obj temporarynotice that the construction of the temporary can be performed by using the oneparameter constructor the use of explicit means that one-parameter constructor cannot be used to generate an implicit temporary thussince intcell' constructor is declared explicitthe compiler will correctly complain that there is type mismatch constant member function member function that examines but does not change the state of its object is an accessor member function that changes the state is mutator (because it mutates the state of the objectin the typical collection classfor instanceisempty is an accessorwhile makeempty is mutator in ++we can mark each member function as being an accessor or mutator doing so is an important part of the design process and should not be viewed as simply comment indeedthere are important semantic consequences for instancemutators cannot be applied to constant objects by defaultall member functions are mutators to make member function an accessorwe must add the keyword const after the closing parenthesis that ends the parameter type list the const-ness is part of the signature const can be used with many different meanings the function declaration can have const in three different contexts only the const after closing parenthesis signifies an accessor other uses are described in sections and in the intcell classread is clearly an accessorit does not change the state of the intcell thus it is made constant member function at line if member function