Duration
5 days
Overview
This five-day instructor-led course provides to teach the details of C++ language This course designed for programmers to explore the advance features of C++.
The approach used is theory followed by powerful seriously designed exercises to reinforce the understanding of the theory.
Besides the language syntax, many aspect of the course are intended to make the participants as better software developer, especially using C++ as programming tool. Many of the aspects covered in this course will benefit the participants in many other project developments.
Upon completion of this course, participants should be able to:
- Apply different advance programming constructs in C++ appropriately.
- Appreciate some fundamental OOP concepts.
- Use C++ syntax in dealing with OOP.
- Realise the pitfall and precaution when using C++.
PREREQUISITES
Participants should have completed the basic introductory to C++ programming. Especially those non-object oriented features of C++.
Module 1: Data Types
This module explains various data types in C/C++.
Lessons
- Data Types Concept
- Number of bytes needed for representing the data
- Value range represented
- Acceptable Value types
- Valid operations on the data
- Simple/native data types
- The sizeof keyword
- Variables
- Variable naming: Pascal and camel styles
- Declaration and Scoping
- Shadowing and Scope resolution operator
- Type casting
- Bit Fields
Union
- New types in C++
Lab: Understand data types
- Exercise 1: Apply appropriate data types
- Exercise 2: Using sizeof keyword
- Exercise 3: Variable shadowing and scope resolution operator
- Exercise 4: Type casting
- Exercise 5: Union and bit fields
After completing this module, students will be able to:
- Select adequate data types to represent the data
- Make use of sizeof in writing better code
- Avoid the shadowing issue and resolve it using scope resolution operator
- Understand the meaning of type casting and its consequences
- Use union and bit fields
Module 2: Storage class
This module explains the meaning of storage class, and relates it to the variable/object life cycle.
Lessons
- Data segment, Stack, and Heap
- auto, static, extern and register keywords
- Constraint on the register variables
- Register parameters
- Variable/Object Life Cycle
Lab: Understand storage classes
- Exercise 1: Automatic variables
- Exercise 2: Register variables/parameters
- Exercise 3: Hiding variables in the module
- Exercise 4: Variable/Object life cycle
After completing this module, students will be able to:
- Know where is the variables/objects defined during program runtime
- Understand various types of storage classes in C/C++ and choose the right one appropriately
- Appreciate the relationship between storage class and variable/object life cycle.
Module 3: Compiler directives and constants
This module explains various important compiler directives and constants used in C/C++ programs
Lessons
- Compiler directives
- #include
- #define
- #if .. #elif .. #else..#endif
- #ifdef
- #error
- #undef
- #pragma
- ##
- Compiler Constants
- FILE
- LINE
- DATE
- TIME
- cplusplus
Lab: Using compiler directives
- Exercise 1: Compiler directive for portability
- Exercise 2: Conditional compilation
- Exercise 3: Forcing error during compilation
- Exercise 4: Forget the definition
- Exercise 5: Control reentrant
- Exercise 6: Source level debugging using compiler constants
After completing this module, students will be able to:
- Use compiler directive to create portable code
- Apply conditional compilation by using compiler directives.
- Display custom error massage during compile time
- Undefine definition from the compiler
- Avoid reentrant by using compiler directives
- Utilize compiler constants in source level debugging
Module 4: Pointers
This module explains pointer concept in C/C++, which is one of the most challenging aspects of the language.
Lessons
- Pointers is simple/native type
- The value Vs address of the storage.
- Parameter passing by value for pointer
- The power of indirect access
- Pointer casting
- void pointer
- Pointer of pointers
- Pointer to functions
Lab: Showing the power of pointers
- Exercise 1: Variable value and address
- Exercise 2: Pointer is a native type
- Exercise 3: Parameter passing by value
- Exercise 4: The power of indirect access
- Exercise 5: Addressing arithmetic
- Exercise 6: Playing naughty with pointer casting
- Exercise 7: The power of pointer to void
- Exercise 8: Dynamic behavior with pointer to function
After completing this module, students will be able to:
- Differentiate the value and address of variables
- Agree that pointer is a native type
- Appreciate the power of using pointer for indirect access
- Understand how the pointer arithmetic works
- Use pointer casting in special cases
- Apply pointer to void appropriately
- Write dynamic behavior code using pointer to function.
Module 5: Complex types
This module explains the concept of complex types in C/C++. More details explanation covered both homogenous and heterogeneous complex types.
Lessons
- Homogeneous Complex Data Type:Array
- Array indexing and out of bound issue
- Open declaration
- Optional last comma
- The use of sizeof keyword on array
- Multidimensional Array
- Array and pointers
- Heterogeneous Complex Types: struct (Record)
- Accessing items in a record
- Pointer to record
- The . and -> operator
- Record of record
- Array of Record
Lab: Using operators
- Exercise 1: Sorting
- Exercise 2: Matrix multiplication
- Exercise 3: char* buf Vs char buf[ ]
- Exercise 4: Student records
After completing this module, students will be able to:
- Understand the concept of complex types in C/C++
- Distinguish the arrays and pointers
- Define multi dimensional arrays.
- Use struct types
- Apply special notation for complex types correctly
- Construct complex in complex types
Module 6: Functions
This module explains more features about functions in C++
Lessons
- Function prototyping
- Multiple modules project
- static functions
- Header files
- What should be there?
- Parameter passing by value
- Passing address as value using pointer parameter
- The Synonym and Parameter passing by reference
- Function Overloading
- Default parameter value
- Function return types
- Complex return
- Return by reference
- Recursive function call
- auto variables and static variables
- Stack overflow
Lab: More Function challenges
- Exercise 1: Multi module project
- Exercise 2: Swap( ) function
- Exercise 3: Sum( ) function
- Exercise 4: Return by Complex
- Exercise 5: Return by reference
- Exercise 6: Magic3x3
- Exercise 7: static variable
- Exercise 8: Stack overflow
After completing this module, students will be able to:
- Appreciate the needs of function prototyping
- Handle multiple modules projects
- Understand why header files is needed and what should be kept in there.
- Differentiate various types of parameter passing in C/C++
- Differentiate the return type of C and C++
- Apply function overloading and default parameter value, and aware the conflict occurs
- Use recursive technique in solving complex problems
- Understand the stack overflow issue.
- Use auto and static appropriately.
Module 7: OOP Supports in C++
This module explains the fundamental Object-oriented concepts that are related to in C++ programming.
Lessons
- From struct to class
- Access Modifiers: private, protected, and public
- Data members
- Member Functions
- Object Instantiation
- this keyword
- static members
- “I call see you but you can’t call me”
Lab : Basic OOP features in C++
- Exercise 1: Circle example
- Exercise 2: Who can see what?
- Exercise 3: Bank Account
After completing this module, students will be able to:
- Understand the relationship between struct and class in C++.
- Use this keyword appropriately
- Define members of the class instances.
- Appreciate the use of members of the class.
- Avoid the reference to instance members from the class member functions.
Module 8: Constructors and Destructor
This module will cover the instance constructors and destructor.
Lessons
- Constructors
- Default constructor
- Parameterless Constructor
- Use of member initialization list
- Destructor
- Default Destructor
Lab: Object Instantiation
- Exercise 1: Person class
- Exercise 2: Student class
- Exercise 3: MyString class
- Exercise 4: Object Left Cycle
After completing this module, students will be able to:
- Understand various object instantiation forms in C++.
- Apply constructor(s) and destructor to the objects.
- Determine the objects life cycle.
Module 9: Inheritance
This module will cover the support of Inheritance in C++.
Lessons
- Inheritance: The support of reusability
- How to and why to involve superclass constructor
- Multiple inheritance
- Conflict resolution
- private, protected, public, and virtual inheritance
- Generic reference
Lab: Reusability via inheritance in C++
- Exercise 1: Staff class
- Exercise 2: Batman class
- Exercise 3: Manager related classes
- Exercise 4: Inheritance types
After completing this module, students will be able to:
- Understand how inheritance promotes reusability in C++.
- Know how and why to involve superclass constructor
- Resolve conflict in multiple inheritance
- Apply the various type of inheritance appropriately by knowing the basic rules.
Module 10: Polymorphism
This module will cover the concept of polymorphism in C++ and its related issues.
Lessons
- Function and operator overloading
- Rules for Operator Overloading
- Rationale for Operator Overloading
- Overloading Member Functions
- Overloading Non-Member Functions
- Overloading Type Cast (conversion) Operator
- Overloading operator new and delete
- Overloading [ ]
- Overloading Increment and Decrement Operators
- Polymorphism and virtual functions
- Static Vs dynamic instantiation
- The late binding issues
- Code efficiency
- Object size
Lab: Polymorphism in C++
- Exercise 1: Matrix class
- Exercise 2: Handle out of bound
- Exercise 3: Sales Manager class
After completing this module, students will be able to:
- Understand the two forms of polymorphism supported by C++, namely static and dynamic polymorphism.
- Apply operator overloading appropriately to simplify the code
- Use advance operator overloading
- Appreciate what are the early and the late binding about.
- Avoid the late binding issues
Module 11: Friend functions
This module will explain the use of the friend functions in C++.
Lessons
- Why use friend functions
- Scenarios
- Syntax
- Access privilege
- Avoid violation of Information Hiding principal
Lab: Why giving friend status to external function?
- Exercise 1: The improve version of Matrix class
After completing this module, students will be able to:
- Appreciate the reason of using friend function
- Apply friend function to avoid violation of Information Hiding principal
Module 12: Pure Virtual function and Abstract Class This module will explain the concept of abstract class. Lessons
- Abstract Class and how it happened?
- The story of What and How
- The Pure Virtual Function
- Prohibited Instantiation
- Methods enforcement
Lab: Use Abstract method instead of polymorphism
- Exercise 1: Revisit the Staff class
After completing this module, students will be able to:
- Appreciate the reason why abstract class occurs
- Understand the concept of pure virtual function and its method enforcement
Module 13: Object copying Issues
This module will explain the issues of object copying.
Lessons
- Deep Vs. shallow copying
- Default objects initialization from existing objects.
- Copy Constructor
- Object assignment
- overload operator=
- use assignment operator in the condition
Lab: Deep copy versus shallow copy
- Exercise 1: The issues of String class
After completing this module, students will be able to:
- Understand the default copying behavior of object initialization and assignment from existing objects.
- Create Copy constructor
- Overload the assignment operator with complete syntax
Module 14: Inline functions
This module will cover the Inline function in C++.
Lessons
- Inline functions
- Inline functions Vs. macro functions
- Inline member functions
- Method implementation out of the class
- Reason
- Syntax for explicit inline declaration
Lab: Understand inline functions
- Exercise 1: inline Vs macro functions
- Exercise 2: Multiple modules project
After completing this module, students will be able to:
- Understand the different and advantages of using inline
- Appreciate the default inline support of the method declaration in the class
- Use explicit declaration to preserve the inline for member functions
Module 15: Template Library
This module will cover the concept of template library in C++.
Lessons
- Template - Parameterize Types
- Template functions
- Specializing a template function
- Template classes
- An array template class
- Instantiating a template class object
- Rules for templates
- Non member function with a template argument
- Friends of template classes
- Templates with multiple type parameters
- Comments regarding templates
- Using export
- Member Templates
- STL (Standard Template Library)
Lab: Understand inline functions
- Exercise 1: Template functions
- Exercise 2: Stack class
After completing this module, students will be able to:
- Understand the advantages of using template function and class
- Apply template concept in reducing coding efforts
- Use standard template library in C++
Module 16: Exception Handling
This module will explain the exception concept and behavior, followed by showing how to implement in C++.
Lessons
- Exception Handling
- Modern runtime environment
- When to apply
- Traditional approaches to error handling
- try, catch, and throw
- A simple exception handler
- Multiple catch blocks
- The exception specification list
- Rethrowing
- Cleanup
- Exception matching
- Inheritance and exceptions
- Catch by reference
- Standard exceptions
- Asynchronous Exceptions
Lab: Exception handling
- Exercise 1: illegal user input
- Exercise 2: Improved Person class
After completing this module, students will be able to:
- Understand the behavior of code when exception occur
- Apply handling appropriately
- Throw exception when appropriate
- Create custom exception object
- Handle multiple exceptions
Module 17: Namespace
This module will explain the concept of namespace in C++.
Lessons
- Namespace Definitions
- Unnamed Namespaces
- Using Directives
- Using Declarations
- Namespace Aliases
- The namespace std
- The namespace anonymous
Lab: Exception handling
- Exercise 1: Using namespace
After completing this module, students will be able to:
- Understand the namespace is about
- Apply it appropriately
Module 18: I/O Streams
This module will cover the I/O stream in C++.
Lessons
- The iostream Library
- Predefined Streams
- operator<<
- Overloading << for User-Defined Classes
- Overloading >> for User-Defined Classes
- Manipulators
- Stream States
- Formatted I/O
- Disk Files
- Internal Transmission of Data
- Reading & Writing Objects
Lab: Using I/O Stream
- Exercise 1: Streaming
- Exercise 2: overload << and >>
- Exercise 3: File access
After completing this module, students will be able to:
- Use standard I/O stream classes
- Overload <, and >> operators Read and write disk file
Programme scope, delivery arrangements and suitability are confirmed during enquiry.