COP 2334 Lecture Notes
Thurs 8/28 (Intro)
- Using the Microsoft VC 5.0 Compiler
(handout & demonstration)
- Simple stream I/O with cout, cin.
- endl (stream manipulator)
Tues 9/2 (Chapter 1)
- Object-oriented vs. process-oriented
approaches to program design.
- Objects, Classes, attributes
(properties), behaviors (methods, operations).
- Declarations and definitions
- Static, automatic, dynamic storage
duration.
- C/C++ Differences: variable
declarations, void argument list, named constants (must
be initialized)
- Enumerated constants
- cout, cin, cerr
Thurs 9/4 (Chapters 1 & 2)
- Cast operator (two forms)
- Reference parameters (example: Swap
function)
- Class relationships: composition,
link, and inheritance
- Encapsulation
- Defining a class (header file)
- Public and private
- Constructors, overloading
- Implementing a class (cpp file)
- Creating class objects (main.cpp)
- Example: the Point class
- Creating a multimodule program
- Suggested practice: p.20-21, #1,2,3,4.
- Suggested practice: p.57, #1,2,3
(office supply store).
Tues 9/9 (Chapter 2)
- Inline and out-of-line function
definitions.
- Using comments to document member
functions.
- Copy constructors (example, p.36).
- Destructors.
- In-class example: Springboard Diving
Scores program (define the problem, design the Dive
class, implement the class methods, write a main test
program, adding validation code to member functions.
Thurs 9/11 (Chapter 2)
- Create the Student Registration
Program (p. 48) from scratch, following the program
specifications.
- Modify the program to calculate the
total credits taken by a single student.
- Suggestions for practice: Add
another student to the input file and create an array of
Registration objects. Calculate the average number of
credits taken by each student.
- Read Chapter 3 for next Tuesday!
Tues 9/16 (Chapter 3)
- Passing class objects by value, by
reference, and by const reference. Notice how copy
constructors enter the picture.
- Employee class, containing an
Insurance object.
- Functions that return const objects
and references to const objects.
- Default argument initializers can
reduce the number of overloaded constructors.
- Writing a sample copy constructor.
- Implementing an Assign() operation.
- Using the keyword this.
- Suggested exercises: Section 2.8.3,
#1-9 (all).
Thurs 9/18 (Chapter 3)
- Would you like to see a complete object-oriented design of an ATM simulation? This one is by Professor Russell C. Bjork,
at Gordon College, Wenham, MA.
- Friend functions and friend classes.
- Implementing the stream input/output
operator functions for classes.
- Guess what? Section
2.8.3, #1-5 is now a required assignment, due October 2. Turn in the complete program listing in a
3-ring duotang folder. No fan-folded paper, please!
Include a diskette with the source code and Windows-95
executable file. If you work on some other computer
system or compiler, just come into the lab and recompile
your project before turning it in.
Tues 9/23 (Chapter 3)
- The Visual C++ CString class is easy
to use! Try the sample program.
- Stream input with get, getline, and
ignore.
- Problems when mixing the use of
>> and getline.
- Using string streams.
- The dec, hex, and oct manipulators for
both input and output.
- Using the setf function with the fixed
and showpoint flags.
- Saving and restoring the state of the
ios flags.
- Setting the decimal precision and
output width.
Thurs 9/25 (Chapter 4)
- Demonstrate the solution program to
Exercise 2.8.3 (#1-5).
- Demonstrate additional Developer
Studio functions: change the compiled project type from
Debug to Release.
- Enumerated constants and enumerated
types. Use the Card class and the SuitType enumerated
type as an example.
- Create a SuitType class, show how it
interacts with the Card class.
- Create a member initialization list,
show how constructor parameters are passed to the
constructors of member objects.
Tues 9/30 (Chapter 4)
- Reference data members and
const-qualified data members.
- Examples: Student, Grade, and
GradeReport classes, p.116.
- Static data members
- Static member functions
- FString class: Demonstrate the
following operations: construction, assignment,
conversion, comparison, stream I/O. (this will probably carry over into the
following lecture)