Implementing Class Methods

Every class method that you declare must also be defined.

A member method (or member function) definition begins with the name of the class and is then followed by two colons, the name of the function, and its parameters.

A member method (or member function) definition begins with the name of the class followed by two colons, the name of the function, and its parameters. Listing 7.1 shows the complete declaration of a simple Cat class and the implementation of its accessor function and one general class member function. ...

Get Sams Teach Yourself C++ in 24 Hours, Third 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.