SlideShare for iOS
by Linkedin Corporation
FREE - On the App Store
This lab will explore the use of pointers in several ways. Pointers will be used to dynamically allocate memory for new class objects on demand from the user, and they will be used to access......
This lab will explore the use of pointers in several ways. Pointers will be used to dynamically allocate memory for new class objects on demand from the user, and they will be used to access class-member functions. Pointer arithmetic will be used to access and sort class objects according to criteria explained in the lab.
Pointers are, essentially, address variables, or variables that hold as their value the address of other variables. In terms of memory management, they are very powerful devices, and they more closely and efficiently use the actual internal hardware registers of the microprocessor that the program operates on.
Pointers also have the requirement that the pointer type must be of the same data type as the variable, or the data that it points to or holds the address of. The power of pointers also hints at the potential complexity of their use, which is why this lab is focused almost entirely on several different aspects and uses of pointers. The lab also introduces pointer arrays and pointers to pointers.
The Resistor class created in the Week 2 lab will be used as the class that the pointer operations will be used upon. The lab also requires the use of accessor functions and static data members, which may need to be added to the Resistor class definition and implementation.