C++ Pointers C++ Pointers
Pointer #1Objects & STL containers
Pointer #2When a member function and variable name collide
This section contains tricks and tips we developed for C++. We call them "C++ Pointers" and hope you'll find them useful.

Our "C++ Pointers" are distributed under the GNU General Public Licence, (GPL). You should review the GNU GPL to know your rights regarding the modification, copying and distribution of our "C++ Pointers" and to be informed that under the GPL our "C++ Pointers" are distributed with NO WARRANTY.

The following C++ pointers are currently available;
Pointer 1Objects, structs and STL Containers
Nearly all the literature (both on-line and textbooks) we referenced to learn how to use STL containers only showed how to use them to hold primatives, such as integers and strings, but made no mention of how to handle objects or structs stored in a container. This "C++ Pointer" shows you how to manipulate objects or structs stored in STL Maps and Vectors.
More details...
Pointer 2When a member function and variable name collide
The standard practice / recommendation on how to handle a member function and variable name collision is to append an underscore '_' to the end of the variable name.

This advice is troublesome when you are adding a mutator member function to an existing class and the variable is widely used throughout the class. Also the resulting code is untidy with some variable names having underscores and the remainder being without.

This "C++ pointer" shows you how to have member function varibles and class variables with same name.
More details...

Last modified 17 May 09
Copyright © 2009 Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
Creative Commons Licence