AP Computer Science Workshop
Why Use the AP C++ Classes?
Problems with C++ Arrays and Strings
- Arrays
- no range checking for arrays
- array size must be defined when you first create array; cannot change size
- Strings
- no range checking for strings
- maximum string size must be defined when you first create string; cannot grow dynamically
- strings must end with '\0'
- must remember to allocate space for extra null byte
- can't use ==, !=, < operators to compare strings
STL vs AP Classes
- STL - Standard Template Library
- Large collection of common classes
- Standard across different compilers (someday)
- AP Classes - Developed for Advanced Placement courses and AP Test
- Smaller collection of useful classes (almost a subset of STL)
- Simpler, easier-to-use
- I use apstring and apvector in CS 1 to talk about declaring and using classes, not implementing them.
Alyce Brady, Kalamazoo College