Chapter 5

 

1 In C++, we have member functions and non-member functions. When we call member function as method we can refer non-member function simply as function.

2 It is a compulsory syntax requirement.

3 Henceforth we will use the term method for member functions.

4 Standard rule. Just as a variable has to be declared before use, data type is also required to be declared before use.

5 In such a case, we have to call the suitable method of the class if one exists.

6 This is not a syntax rule. If a function has nothing to do with class objects, it need not be present in that class definition.

Get Object Oriented Programming with C++, Second Edition 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.