140 likes | 155 Views
Detailed review covering program structure, data types, classes, input/output, arrays, MVC architecture, polymorphism, design patterns, operator overloading, exception handling, and templates in C++. Includes lectures slides on key topics.
E N D
Advanced Program Design with C++ Review Joey Paquet, 2007-2019
Review – General Notes • The final examination (regular or programming examination) is based on the material covered in the lectures. • Covers all material from beginning to end. • Review the slides as covered in class. • Make sure that you understand all the code examples used in the lectures, whose code is provided on the course web page. • The following slides lists the topics that are included as material that may be subject of final examination questions. Joey Paquet, 2007-2019
Review – Slide Set 1 – Program Structure • Structure of a C++ program • Code separation in .hand .cppfiles • #include, using namespaces across .hand.cppfiles • Different kinds of namespaces • Compilation units • Compilation process Joey Paquet, 2007-2019
Review – Slide Set 2 – Data Types • Data types: structs and classes • Pointers • Concepts and operation • Stack/heap/new/delete • Pointer arithmetics • Memory allocation – stack and heap • Type checking and type casting • static_cast, dynamic_cast • Upcasting, downcasting • References • Parameter passing Joey Paquet, 2007-2019
Review – Slide Set 3 – Input/Output • Input/output streams – console/keyboard, files • Files stream declarations, open/close, usage • >> and << operator overloading • Not covered: MFC serialization Joey Paquet, 2007-2019
Review – Slide Set 4 – Classes • class vs struct • Declaring/using objects with or without pointers • Class declarations (.h) vs class implementation (.cpp) • Inline functions/methods • const specifier • static specifier • Friends (classes, member functions, free functions, operators) • Constructor/destructor • Declaration/implementation • Initialization list • Implicit/explicit constructor calls • Assignment operator overloading • Copy constructor • Shallow/deep copy • Single/multiple inheritance Joey Paquet, 2007-2019
Review – Slide Set 5 – Arrays • Statically allocated arrays (one or multidimensional) • Declaration, usage • Memory allocation model • Dynamically allocated arrays (one or multidimensional) • Declaration, usage • Memory allocation model • Passing arrays to and returning arrays from functions • STL containers (e.g. vector) • Declaration, usage • Iterators Joey Paquet, 2007-2019
Review – Slide Set 6 – MVC architecture and Observer Pattern • MVC • concept, structure, behavior • no implementation • Observer Pattern: covered Joey Paquet, 2007-2019
Review – Slide Set 7 – Polymorphism and Virtual Inheritance • Polymorphism in C++ - virtual methods and pointers • Pure virtual methods & abstract classes • Object slicing • Value and reference semantics • Virtual methods tables (vtables) • Virtual inheritance and the diamond problem Joey Paquet, 2007-2019
Review – Slide Set 8 – Design Patterns • For all patterns covered in class: • Problem solved by the pattern • Concepts involved in the pattern • Structure of the pattern • Behavior of the pattern • C++ implementation of the pattern • Patterns covered in class: • Factory • Builder • Singleton • Adapter • Decorator • Observer • Strategy • Only the patterns that were used in the project for both sections are subject to examination questions: • Observer, Strategy. Joey Paquet, 2007-2019
Review – Slide Set 9 – Operator Overloading • Operator overloading • As member of a class • As free operator • As free operator friend of a class • Stream input/output operators (>> and <<) • Assignment operator – including vs memory leaks, self-assignment, and assignment to an expression. Joey Paquet, 2007-2019
Review – Slide Set 10 – Exception Handling • Try/throw/catch – syntax, concepts, functioning • Stack unwinding • vs constructors/destructors • User-defined exceptions Joey Paquet, 2007-2019
Review – Slide Set 11 – Templates • Templates metaprogramming in C++: implementation • Concepts • Compilation/execution process • vs .hand .cpp files and separate unit compilation • vs static members and variables • vs Java generics (type erasure is not covered). • Template classes, methods, free functions, operators • Declaration • Usage and instantiation • Template specialization Joey Paquet, 2007-2019
Review – Questions style • Many objective questions (a.k.a “multiple-choice”) • True/false are subject to negative marking in case of wrong answer. • Multiple choice (i.e. choose a,b,c, etc) are not subject to negative marking. • All such questions are taken directly from what was presented in class. • Read the slides carefully. • Programming questions: • You will not be asked to write a program “freehand”. • You may be asked to trace the execution of a given program. • You may be given a partial program and asked to complete the program in order for it to achieve a predefined behavior. • Make sure that you understand all the code that we presented in class. Joey Paquet, 2007-2019