... specify the object’s name (
myAccount), followed by the dot operator (.), then the member function name (
getName) and a set of parentheses. The empty parentheses indicate that
getName does not require any additional information to perform its task. Soon, you’ll see that the
setName function requires additional information to perform its task.
main’s view, when the
getName member function is called:
The program transfers execution from the call (line 13 in
main) to member function
getNamewas called via the
getName“knows” which object’s data to manipulate.
Next, member function
getNameperforms its task—that is, it returns (i.e., gives back)
myAccount’s name to line 13 where the function was called. The main ...