... 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.

From main’s view, when the getName member function is called:

  1. The program transfers execution from the call (line 13 in main) to member function getName. Because getName was called via the myAccount object, getName “knows” which object’s data to manipulate.

  2. Next, member function getName performs its task—that is, it returns (i.e., gives back) myAccount’s name to line 13 where the function was called. The main ...

Get C++ How to Program, 10/e now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.