Overview
This week we will dive deeper into operator overloading and get more practice writing classes in C++.
Friday, December 8th
Classwork / Homework
We will have a catch up day for some of you, while others will have very little work needed to complete today's task, but it will hopefully leave us all on the same page.
Your task is to download a copy of
test_points.cpp, and create Point.h
and Point.cpp
files that will pass all these tests without modification.
This assignment is due by 11:59 pm on Saturday, December 9th and will not be accepted late. It will be the first part of your Weeks 16 and 17 grade.
I will evaluate your work by running:
$ g++ test_points.cpp Point.cpp
and then running the a.out
file generated. If it passes all the
tests, you earn an A. If it doesn't, I'll need to dig into your source to
figure out what partial credit you deserve.
Wednesday, December 6th
Classwork
Once again, José Ejemplo has provided us with an example solution to our last homework assignment. Please try it out and make sure you can make it work during class today.
For an additional example of <<
overloading, take a look at
Overloading the << Operator for Your Own Classes.
Homework
Complete problem 5 from
Chapter 15 Excercise Set 1. Be sure to divide your Point
into three files: Point.h
, Point.cpp
, and
test_point.cpp
.
This assignment is due by 2:59 pm on Thurday, December 7th and will not be accepted late.
Monday, December 4th
Reflection on Chapter 15 Exercise Set 1 Part 1
Going forward, don't put your main
function inside your
MyClass.cpp
file. Instead, create a separate file named
test_myclass.cpp
and either import doctest.h
(preferred) or instantiate and test your class by hand
in your own
main
function.
For our last homework assignment, our good friend José Ejemplo has provided us with an example solution he was kindly willing to share.
Classwork / Homework
Complete problem 4 from
Chapter 15 Excercise Set 1. Be sure to divide your Complex
class into three files: Complex.h
, Complex.cpp
, and
test_complex.cpp
.
This assignment is due by 11:59 pm on Tuesday, December 5th and will not be accepted late.