Lecture 6: Objects & Classes
Thursday 02/15, 2007
[Up]
[Previous Lecture]
[Next Lecture]
Assigned Reading: 7.1, 7.2
Slides As Shown:
Topics Covered:
- Announcement: Section 0105 can "make up" lab.
- Answered questions about
Project 1
- Recap constructors:
- Reviewed basic use: slides.
- Showed a quick-and-dirty program for tracing constructor calls:
constructors.cpp.
- BTW, Mr. Ellington pointed out after class that invoking the alternate
constructor from the default constructor:
abc(17) ;
doesn't do what we thought. This creates a temporary object of type abc,
initializes its data member to 17 and throws away the temporary object.
It doesn't initialize the data member of the "current" object.
- const members & methods. See slides linked above.
- The built-in int type has problems with
initialization and with overflow. We began a discussion of the
design for a class called ReallyLongInt (dubbed by the
class). Discussion will be continued next class.