Wyo C++ - Chapter 12 Resources

Ch. 12 Vocabulary

Ch. 12 Lecture Notes - classes

Ch. 12 Worksheet #1 - identifying parts of the a class definition and implementation

Ch. 12 Worksheet #3 - writing class defenitions

Ch. 12 Demo Programs

Demo Program #1 - using a Circle class
Demo Program #2 - review the use of struct definitions and variables
Demo Program #3 - to illustrate the use of a struct definition and a user-defined function
Demo Program #4 - to illustrate the use of a class (with the interface & implementation all in the same file with the main function of the program that uses the class)
Demo Program #5 - to illustrate the use of a class where the interface and the implementation are in separate files
Demo Program #6 - to illustrate a simple example of a Student class
Demo Program #7 - to introduce a class

As a class, build Ch. 12 Demo Program #7 from "the ground up" ...

  • uses a struct with only member variables

  • uses a member function that neatly displays all of the member variables
  • uses a default constructor so that the member variables are instantiated to good default values like 0
  • uses another constructor to allow the client to instantiate objects to selected values
  • uses a modifier function that allows the client to set values without using the assignment operator and that performs input validation in the modifier member function rather than in the client program
  • uses an accessor function to allow the client to display or "get a value" from a member variable indirectly
  • as an exercise, document Ch 12 Demo Program #7 detailing which members are member variables, member functions, constructors, accessors, etc.
  • as an exercise, write the remaining modifiers and accessors for the class
  • change the data (member variables) into the private partition of the struct & keep the member functions in the public partition - observe errors that result from making everything private though
  • change the struct into a class and discuss the difference between structs and classes
  • move the class interface into a header file
  • move the class implementation into an implementation source file

"On the Net" Topics (textbook Web site)

Ch. 12 Programming Assignment