[ Post New Message | Post Reply to this One | Send Private Email to Michael McNally | Help ]

object.function() ???

from Michael McNally (mjmcnall@hotmail.com)
I am a true novice to C++ and am enjoying reading "Who's afraid of C++?". I am also glad to learn that there is a second book in the series.

I think this is an excellent book, which somehow keeps things interesting even when you are re-explaining a concept which I understood already. I am stuck on chapter 6 right now, and though I think I have grasped the concept of classes and objects (after rereading the first half of the chapter a few times) there is one thing that is driving me nuts. That is the syntax of the usage of class objects and class functions, e.g., soup.Display() (Figure 6.8). Now it seems to me that this is passing the variable soup to the function Display, but if this was the case it would be written Display(soup), which doesn't make sense either, given the definition of the display function. I am surprised that I can't find an explicit explanation of the object.function() syntax anywhere in the book, and only a brief mention of it in several other C++ books I've thumbed through. I am forging ahead anyway, and I'm able to understand everything so far (through to the end of chapter 6 anyway), but I find the lack of an explanation of this very annoying every time I encounter it. I just can't seem to find a way to translate object.function into english (or math!) that I can understand. (What's even more troubling to me is how this got past Susan without a big discussion. Am I the only one missing something obvious?)

(posted 6080 days ago)

[ Previous | Next ]