... 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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.