///File Footest.cc, by KWR for CSE250 Spr'00. Test code for classes Foo, Bar. #include #include #include "Bar.h" #include "Foo.h" //#include "Foo.cc" ///<-- Delete when you do separate compilation with "make" /// See what errors you get if you leave this line commented-in with "make". int main() { Bar* bp = new Bar; ///default constructor automatically supplied! Bar* bq; ///simply an uninitialized pointer. Gives a warning. Bar b; ///default constructor used here too. int i,j; i = j = 7; cout << i +++ ++ j << endl; Foo* fighter = new Foo(bp); /// If you follow Java and make all objects pointers, then you won't /// feel any need to suffix "p" to distinguish the pointers! fighter->alterMyField(bq); /// Using . here is a common mistake! if (fighter->getMyField() == bp) { cout << "No change was made!" << endl; } else { cout << "Call to alterMyField() allowed thanks to \"friend\"" << endl; } }