Exam Two Review¶
This exam will cover the basics of Object oriented programming, and material covered since our last test.
Objects and Classes¶
Basic Class structure
Header file
Public definitions
Private definitions
Implementation file
Class methods
Using classes
Including the class header
Creating objects
Calling class methods (messages)
Designing classes¶
Think first, code later
Separating concepts - objects from the user’s world
Keep responsibilities separate
focus on objects from the users world
What data are required for those objects?
What behavior do those objects need to provide?
decide on what parts of your class cna be
public
, and which should beprivate
Types of methods:
Constructors * Default * Copy Constructors
Destructors
Accessor methods
Mutator methods
Writing classes¶
Build a header file for the class
Know the standard template for header
Build implementation for the class
Add class files to project
Array topics¶
Initializing arrays
Passing arrays to functions
Searching and Sorting¶
Simple searching
Bubble Sorting
Pointers¶
What is a pointer?
How do you create a pointer?
Pointer math (arrays).
Pointers that point to nothing.
Getting the address of a variable.
Linked Lists¶
Management class controls access to the list
Creating new objects with
new
What is a destructor, and why is it needed>
What is a
copy constructor
and why is it needed?
Complex Numbers¶
Classes create new data types
Define the structure for your new type (in this case a real and imaginary floating point part)
Write methods that make the type work properly
New methods for addition, subtraction, output, etc.
Complex::operator+(const Complex lhs, const Complex rhs);