February 22, 2002 Reading assignment: Deitel and Deitel - 7.5 - 7.7 -or- Wang Today we'll work on programming assignment 4 together - This assignment will be worth more than the other programming assignments - First we'll build the declarations of the classes StudentRec and StudentGroup. This won't be the final version, because we need to supply a destructor, an overloaded copy constructor and an overloaded assignment operator. We'll discuss how to do this next week - After writing the class declarations, we'll write skeletons for the class implementations - Next we'll write a skeleton for the main program - Finally, we can implement the details of all of the functions - We'll discuss how linked lists are used to manage dynamically allocated memory Section 7.5 from Deitel and Deitel - the "this" pointer - Inside of the implementation of a class, you can have access to data members merely by mentioning their name. These data members are part of "this" object, and you can have access to the address of this object. Inside of the implementation of the class, the variable named this points to this object - Inside of an implementation, the expression this->data_member is synonymous with data_member - One use of this is to use it to have certain member functions return a pointer to this object, allowing clients to "cascade" their member calls. You can read about this use of this in section 7.5 of D&D. We'll return to this in Chapter 8 when we overload the << and >> operators Section 7.7 from Deitel and Deitel - static member functions - It's possible to have member functions that belong to an entire class, rather than to each object. In other words, every object of a class can share the same copy of a data member. - You can even have static member functions. These functions can be called even if you don't have an object of that class, but they cannot access any data members, unless those data members are also static. - Next time I'll show you an example of using a static data member in our StudentRec class