Did I happen to mention? • Final exam Final Exam Review – The date for the Final has been decided: – Saturday, November 16 th – 8am – 10am – 01-2000 • No makeup finals! Project Notes Today • Grand tour through CS4 • Parking Lot Problem: due tonight • Team Evaluations: due tomorrow night UML C++ Basics • Class Diagrams • #include files – Note about associations – .C and .h files • Sequence Diagrams • Variable types – Automatic • Use cases – References – Pointers 1
C++ Basics C++ classes • const • Functions – const functions – Pass by value – const arguments • Arrays – const variables – Arrays == pointers • static – No bounds checking • Function / operator overloading – A + b equivalent to A.operator+ (B) – operator= C++ classes C++ other features • Constructors • Assertions – Default constructor • Enumerated types – Copy constructor – operator= – Initializer list • Destructor – Called when delete • This was the end of Exam 1 – Called when local variable goes out of scope. Memory Management Inheritance • Storage types • Initializer list – Automatic (local) – stack • Polymorphism – Static (global) – Works only with pointers and references – Dynamic (heap) – free store – Slicing • new / delete / delete [] – virtual functions • Memory Woes • Pure virtual functions – Memory Leak – Abstract class – Dangling Pointer • Implicit not explicit • Reference to local variable • Multiple inheritance – Pointer Ownership – Overwriting Arrays 2
Testing Templates • White box vs. black box • Correct syntax • Unit / integration / system test – template <class X, class Y> not – template <X,Y> • Programming by contract • Class and function templates • Test 2 ended here STL IOStreams • Containers • Extraction – Read / operator>> • Iterators – Read white space then read value – Type::iterator – Check for error after read – Const iterators • Insertion – Traversing collections with iterators • The deal with maps – Write / operator << – Manipulators – pair<> • Formatted vs. Unformatted – value_type • STL strings vs. char * • IO State (good(), bad(), fail(), eof()) IOStream Exceptions • Can throw anything • Catching Exceptions – try/catch block ordering • Exception specifications • Stack unwinding – Dynamic memory & exceptions • Exceptions vs. assertions 3
File Organization Ethics • Organization schemes • No exam questions – Sequential – Indexed – Indexed Sequential – Multi-indexed • B-Trees – Insertion only Questions? Once again… • Final exam – The date for the Final has been decided: – Saturday, November 16 th – 8am – 10am – 01-2000 • No makeup finals! Course evaluations… 4
Recommend
More recommend