YALE UNIVERSITY
DEPARTMENT OF COMPUTER SCIENCE
CPSC 427a: Object-Oriented Programming | Handout #6 | |
Professor M. J. Fischer | October 12, 2010 | |
Study Guide to Exam 1
For the exam, you are responsible for the contents of lectures 1–11, the class demos, the concepts used in problem sets 1–3, and the corresponding sections of the textbook. In greater detail, you are responsible for the following chapters and sections of the textbook:
In addition, Chapter 15 presents some detailed code examples that use polymorphism and virtual functions. While we haven’t gone through the examples in class, you should read this chapter and make sure you understand how these concepts work in the examples presented there.
Below is an index to the lecture notes. It lists all of the sections, subsections, and slide titles from lectures 1–11.
∙ Where to find information
∙ Course mechanics
∙ Topics to be Covered
∙ Course goals - practical
∙ Course goals - conceptual
∙ Two views of programming
∙ Problem solving
∙ Software Construction
∙ Programming in the large
∙ Three commandments for this course
∙ Can is not the same as should!
∙ General properties of C++
∙ C++ Extends C
∙ Some Extensions in C++
∙ Tools
∙ Generic Insertion Sort
∙ C version
∙ C++ version
∙ dataPack.hpp
∙ class DataPack
∙ Class elements
∙ Inline functions
∙ Visibility
∙ Constructor
∙ Constructor
∙ Destructor
∙ Destructor
∙ dataPack.cpp
∙ File I/O
∙ main.cpp
∙ Manual compiling and linking
∙ Makefile
∙ Integrated Development Environment (e.g., Eclipse)
∙ Integrated Development Environment (e.g., Eclipse)
∙ Integrated Development Environment (e.g., Eclipse)
∙ Toolset to use for course work
∙ Working remotely
∙ 1. Replicate the Zoo environment on your own machine
∙ 2. Remote login to the Zoo
∙ 3. Set up a virtual Zoo desktop on your machine
∙ Homework submission
∙ A brief course review to date
∙ How to use the textbook
∙ Opening and closing streams
∙ Reading data
∙ Writing data
∙ Manipulators
∙ End of file and error handling
∙ Handling data errors and end of file
∙ How to write a test program
∙ Classes, visibility, functions, inline
∙ Stack example
∙ Call by value
∙ Call by pointer
∙ Call by reference
∙ I/O uses reference parameters
∙ How should one choose the parameter type?
∙ Sending data to a function: call by value
∙ Sending data to a function: call by reference or pointer
∙ How should one choose the parameter type?
∙ Sending data to a function: call by value
∙ Sending data to a function: call by reference or pointer
∙ Receiving data from a function
∙ The implicit argument
∙ this
∙ L-values and R-values
∙ Simple variable declaration
∙ Simple assignment
∙ Automatic dereferencing
∙ Pointer values
∙ Pointer creation
∙ Pointer variables
∙ Pointer assignment
∙ Following a pointer
∙ Pointer example
∙ Pointer declaration syntax
∙ Reference types
∙ Reference declarators
∙ Use of named references
∙ Reference parameters
∙ Reference return values
∙ Custom subscripting
∙ Constant references
∙ Comparison of reference and pointer
∙ Pseudorandom number generators
∙ Random numbers in C++
∙ rand() and srand()
∙ Generating uniform distribution over a discrete interval
∙ Generating random doubles
∙ Alternate method for generating uniform distribution over a discrete interval
∙ Generating exponential distribution
∙ Bar Graph Demo
∙ Bar Graph Demo
∙ Notes: graph.hpp
∙ Notes: graph.cpp
∙ Notes: row.hpp
∙ Notes: row.cpp
∙ Nested classes: rowNest.hpp
∙ Storage classes
∙ Assignment and copying
∙ Static data members
∙ Static function members
∙ Five common kinds of failures
∙ Optional parameters
∙ const
∙ const implicit argument
∙ Operator extensions
∙ Coding conventions for this course
∙ Coding conventions (cont.)
∙ Error checking and error handling
∙ Design choices
∙ PS2 issues
∙ What is a class?
∙ Class relationships
∙ What is derivation?
∙ Instances
∙ Some uses of derivation
∙ Structure of an object
∙ Referencing a composed object
∙ Referencing a base object
∙ Initializing an object
∙ Construction rules
∙ Destruction rules
∙ Constructor ctors
∙ Initialization ctors
∙ Initialization not same as assignment
∙ Copy constructors
∙ Private derivation (default)
∙ Private derivation example
∙ Public derivation
∙ Public derivation example
∙ The protected keyword
∙ Protected derivation
∙ Privacy summary
∙ Polymorphism and Type Hierarchies
∙ Polymorphic pointers
∙ Virtual functions
∙ Unions and type tags
∙ Virtual destructors
∙ Uses of polymorphism
∙ Multiple representations
∙ Heterogeneous containers
∙ Run-time variability
∙ Pure virtual functions
∙ Abstract classes
∙ Extending existing code
∙ Summary of extensions
∙ 1. Polymorphic dice
∙ 2. Command line interface
∙ 3. Command line parser
∙ 4. Naming convention with underscores
∙ 4. Naming convention without underscores
∙ 5. Print functions
∙ Other changes
∙ Surprising example 1
∙ Surprising example 2: contrast the following
∙ Surprising example 3
∙ Names, Members, and Contexts
∙ Declaration and reference contexts
∙ Declaration context example
∙ Reference context example
∙ Inside and outside class references
∙ Examples
∙ Inherited names
∙ Inheritance example
∙ Inaccessible base class
∙ What is a Class: Syntax
∙ Class Relationships
∙ Class Relationship Between Two Classes
∙ Class B appears in Definition of Class A
∙ B as Data Members in A
∙ B as Data Members in A
∙ Creation and Deletion
∙ Example: BarGraph Class Interaction
∙ Association Relationship