Lesson 1
Today's lesson will introduce classes and objects in C++!
We'll address the following learning goals from Group 3 and Group 5:
- Goal 3C (Program Organization):
- Explain the division of code into header and source files.
- Use
#include
directives to ensure that declarations of variables, classes, functions, etc. are visible.
- Goal 5B (Lifetime Timing):
- Identify where in a program each phase of lifetime (allocation, initialization, use, destruction, deallocation) happens for an instance of a class.
I want to learn MORE C++ syntax please! Some is good, but LOTS is better.
You get your wish!
Oh, no!!
Don't worry if it doesn't all fit in your head right away!
You can come back to these pages for details when you code; familiarity will come with experience!
Outline
- Before You Start…
- A C++ Class
- C++'s Class-Related Terminology
- Declarations/Definitions
- Member Variables
- Member Functions
- Aside: Namespaces
(This might be a good time for a stretch break!)
- const Member Functions
- Exercise: const Member Functions
- Constructors
- Exercise: Constructors
- Constructing Objects
(You might consider taking a break before moving on…)
- Objects in Our Memory Model
- Member Initialization List
- Access Control
- Semicolon at the End!
- Key Points
- Before You Go…
To receive credit: complete all pages above, then this page will be complete as well (and get a green check emoji at the bottom right of the page).
(When logged in, completion status appears here.)