CSC 160 - Chapter 7 Quick Reference
Chapter 7 "Structures and Classes"
This chapter covers abstract data types, represented as structures
and classes in C++.
General Terms
abstract data type |
primitive data type |
|
|
structure |
members |
dot operator |
nested structures |
union |
anonymous union |
|
|
procedural programming |
object-oriented programming |
|
|
class |
object |
access specifiers |
instance |
inline function |
class specification file |
class implementation file |
|
constructor |
destructor |
default constructor |
|
C++ Syntax/Constructs
struct |
union |
class |
public |
private |
:: (scope resolution operator) |
|
|
Concepts
Important concepts covered include:
- Understand the difference between an Abstract Data Type (ADT) and
a primitive data type
- Be able to create and manipulate structures:
- Defining a structure
- Defining structure members
- Creating structure variables
- Initializing structure members
- Accessing structure members (dot operator)
- Using other structures as members (nested structures)
- Passing structures as function arguments, including the
special case of "constant reference parameters"
- Understand the difference between unions and structures
- Define and use an anonymous union
- Understand the difference between procedural and object-oriented
programming, what are the deficiencies of procedural programming?
- Be able to create and manipulate classes and objects:
- Defining a class
- Understand the access specifiers: public and private, why are
each of these necessary?
- Defining member variables
- Defining member functions
- Creating a class object (as a variable or array)
- Accessing object member variables and functions (dot operator)
- Understand the difference between an inline function and one
implemented outside a class definition.
- Understand using separate files to hold the definition (class
specification file, .h) and implementation (class implementation
file, .cpp) of a class
- Understand constructors:
- Syntax when defining a constructor (no return type)
- When are constructors called?
- default constructors
- overloading the constructor
- default arguments in a constructor
- Understand all the above with desctructors
Disclaimer: The goal of this "cheat sheet" is to review
the more important concepts in the chapter. The exclusion of any
material in the chapter from this "cheat sheet" does not mean
that you are not responsible for that material.