Basic intro concepts: - Compiled vs. interpreted languages (e.g., C++ vs. Python) - Classes and Objects - OOP vs. procedural languages - Invoking the C++ compiler Basic Syntax - Legal identifiers - Allowable characters, case sensitivity - Rules vs. conventions - Literals - Numerical literals (e.g., 1, -5.5) - String literals (e.g., "Hello, world\n") - Character literals (e.g., 'A') - Constants - Defining using "#define PI 3.14" - Defining using "const double PI=3.14" - variable declaration - basic format - where it can appear - What "scope" is - Local variables vs. global variables - Declaring (or re-declaring) variables in a nested block: nested scope - Are local variables automatically initialized? - Basic types in C++ - int, double, char, bool - What is difference between short, int, and long? - Operators: - Arithmetic - Relational - Logical (boolean) - Assignment - Binary vs unary operators - Shorthand operators: x++, x--, x += y, x*= y - Precedence and associativity - [Short circuiting?] - Expressions, statements - Type conversion - In arithmetic operators: e.g. int + double - in assignment: int x = 5.5; - Using casts (e.g. "(double) x" or "static_castx - Single statements vs. statement blocks (a.k.a. compound statements) - Using curly braces: "{...}" - Lvalues vs. Rvalues - Comments: "/*...*/", and "//" Console input/output - cin, cout, cerr - #include - <<, >> operators Control Flow - Conditionals - Syntax of "if/then/else" statements - Interpretation of ints as true/false (e.g., is -1 "true"?) - What does "int x - true" do? What about "bool b = (2 > 1)"? - Switch statements (essentially a fancy type of conditional) - Loops - while(x) { ... } - do { ... } while (x); - "for" loops - break, continue Minimal Program: - Should be easily able to write a simple "Hello, world" program from scratch - main() - usual declaration ("int main(int argc, char*argv[]")-- what do parts mean? The C++ Preprocessor - #define -- what this directive does - #ifdef/#ifndef/#endif -- what these directives do Program file structure: - Difference between .h and .cpp files - What to put in each - How header file includes work: - #include -- what this directive does - How to "guard" the contents of a header file - Why is this necessary? Makefiles Functions - Syntax for declaring a function (a.k.a. "function prototype") - Syntax for defining a function - Syntax for calling a function - Declaring return type - Declaring formal parameters - Difference between function declaration and definition - Overloading functions: - Function signatures - How function selection interacts with automatic parameter type conversion Function Parameters - Formal parameters vs. actual parameters (a.k.a. "arguments") - Call-by-value vs. call-by-reference - Syntax for each - Differnce between the two - What happens in each case when you reassign a value to the parameter var inside the function? - You should be able to write a simple swap() function that exchanges the actualy parameter variables so that caller is affected. - "const" parameters: (e.g. "void Foo(const int x) { ... }" - what does declaring a parameter to e "const" do? - Default parameter values Arrays - How to declare local variable as an array; - 2-dimensional arrays - Initializing arrays - How are C-strings represented? Array-of-chars... - How are arrays stored? - Accessing array elements: using "x[pos]" indexing - Array out-of-bounds errors - How to declare as parameter in function declaration/definition - Are array arguments to function calls passed by-value or by-reference? Structures - What it's for - How to define one - How to use one - Are struct arguments to function calls passed by-value or by-reference? Basic Pointers: - How to declare a pointer (e.g. "int *xPtr" to declare xPtr as "pointer to int") - How to get the address of another variable (e.g. "xPtr = &myInt") - Using pointers to simulate call-by-reference - Pointer arithmetic: what would "*(xPtr + 1) = 0" do? - "*" and "&" operators Command Line Arguments Preconditions and Postconditions Classes - What is a class? - Difference from a struct - Class "interfaces" - Abstraction/information hiding - What is benefit of keeping implementation details from user? - Syntax for defining a class - Data members and function members - private versus public members - Who (i.e., what functions) can access public members? Private members? - Accessors, mutators, facilitators - Where/how to define member functions - Member function access to data members - const calling object (e.g., "void memberFunc(int x) const { ... }" - calling rules: can a const member function call a non-const member function? What about the reverse? - Constructors: - Defining constructors: name? return type? - Default (i.e., no-arg) constructor - Why is it important? - When is one provided automatically? - Other (i.e., non-default) constructors - Initialization lists for constructors - Aggregation: - Including classes (actually, class isntances) inside other classes - If nested object is private (recommended), how does user of main class access members of nested class? - Static members: - static function members: - What are they for? What are they not allowed to do? - static data members - What are they for?