1. Wednesday, 11/4/2009 Notes

    In lecture today, a number of topics were covered, all under the general idea of “operator overloading” for classes:

    • the idea of operator overloading for classes
    • the notion of operator?? methods being built into our classes
    • the syntax for operator overloading in .h and .cpp files
    • the notion that we must choose semantics (meaning) for operator overloading (sure, I can use == on Rectangles, but what does that mean w/ respect to Rectangles?)
    • the this keyword
    • the notion that operators should allow symmetry when possible
    • the definition of friend functions

    Here is the Rectangle class we have built so far: Rectangle.h, Rectangle.cpp, rectangleMain.cpp.  These files can be compiled using the following syntax (if not using a makefile): g++ -o rectangleMain rectangleMain.cpp Rectangle.cpp

    Since a lot of material was covered today, here are some slides that cover the key points: OperatorOverloadingI.pdf

    A new homework (#4) will be posted soon and be due the middle of next week.