Jump to content

Talk:Mutator method

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SineBot (talk | contribs) at 13:02, 31 July 2012 (Signing comment by Kchrdk - "Access time: new section"). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
In computer science the mutator method is a method that changes the value of the argument variables.

Wrong, the object the function is called on is changed, not the variables that are passed as argumetns to the method/function

In the call-by-value form of argument passing, a reference or pointer to the data needs to be passed.

Wrong, no explicit need for that, just because its a mutator. And the example also shows pass-by-value of an integer —Preceding unsigned comment added by 84.176.233.185 (talkcontribs) 09:01, 18 May 2006

C++ example

C++ example is missing usage (main.cpp). — Preceding unsigned comment added by 192.116.217.162 (talk) 10:03, 20 December 2011 (UTC)[reply]

Access time

"Accessor functions are always less efficient than directly fetching or storing data fields due to the extra steps involved"

This quote refers to a document from 1998 and is false. For example, the de facto approach to implement accessors in C++ is to write them directly inside the class definition. This causes them to automatically become "inlined" which -when compiled with a modern compiler- will render the exact same access times as if the corresponding class member had been declared "public" and was accessed directly. This contradicts the above claim that accessor functions are always less efficient. As a matter of fact, using a modern compiler accessors in C++ are only less efficient if they are implemented in a separate source file (though I have never seen anybody do this myself). — Preceding unsigned comment added by Kchrdk (talkcontribs) 13:01, 31 July 2012 (UTC)[reply]