Computer Science E50b
Tuesday Section . 7pm . Science Center 111

TF: Alix Marchandise-Franquet
February 16, 1999


Operator overloading

Chapter 8 (Deitel&Deitel)


Building a class for a student

Suppose that you were to build a class for a school to store information regarding students. You want to keep track of certain information regarding each student who is enrolled at the school, and you want to provide functions that will enable the school to store/retrieve information regarding a given student.

Data to keep track of:

Functions to build:
Of course, there should be constructors (at least one), amd accessor methods (functions to get the value of the private data members or to set those values). There is a function that computes and returns the age of the person, and one that overloads the << operator to print all the information regarding the student.

Of course, there are many many many other things you could do... Feel free to add them!

The following files contain the code:
student.h : contains the class
student.cc : contains the definitions for the public member functions and friend functions of the class
studentmain.cc : a sample main

To compile this program, just type: g++ student.cc studentmain.cc -o student


Building a vector class

Build a class to hold 2-dimensional vectors.

What do you need?

vector.h
vector.cc
vectormain.cc

To compile this, type
g++ vector.cc vectormain.cc -o vector