CS 112
Lecture 8
Classes
Object-oriented programming in C++
- Classes: introduction to object-oriented programming.
- A class is like a struct but with extra stuff added to
it: functions that work only on objects of that type.
- Object-oriented programming: induces a certain way of
thinking, whereas programs manipulate objects using only
the methods (or functions) that are allowed to be
applied on those objects.
- Defining classes in C++. An example.
Cookie Jar abstract data type.
- Header files.
- Compiling complex programs with many source files using Makefiles.
- Lab: copy, test and understand the Cookie Jar example. Then modify
the main program by adding a menu-based user interface, which allows the
user to select the class function to be tested next.
Summary of C++ and Unix basics for working with classes
- Structure of
a C++ program using classes (header file, implementation file,
makefile, testdriver).
- Wisely using header files. Example: the
bool.h header file in the stack class example.
- Makefiles:
what they are and how to use them.
- Compiling a class implementation without creating an executable file.
- Creating an executable file from previously compiled object files.
- Compiling only the files that have been modified, or which
depend on other files that have been modified.
- Makefiles. An example of a good
Makefile for the hwk stack exercise.
- Tutorial on the
make utility.
- Problems when compiling on both
grendel and hermite. Read this carefully!!!
Ileana Streinu