Page 1

Course information

C++ Programming for (non C) Programmers

Duration: 5 days

Course Description The C++ for (non C) Programmers course provides thorough practical and theoretical coverage of the C++ language for the experienced application programmer who has little or no recent C experience. It helps eliminate misconceptions and poor programming practices that can cause so many problems, by focusing on features of the language and standard library that enforce good practice and encourage clear and robust code. This is a highly practical course which uses a mix of tuition and practical sessions for each technical chapter designed to reinforce the C++ syntax and object-oriented programming techniques covered in the course.

Course Objectives • • • • • • • • • • • •

Understand the key concepts and vocabulary of object orientation Use fundamental and composite data types Define and use classes Write class member functions Use pointers and dynamic memory Use constructors and destructors Write code that is efficient and robust Build new classes from other classes using aggregation and association Build new classes from other classes using inheritance Use container classes, including template classes Use operator overloading Design and write code with polymorphic behaviour

Prerequisites • • • • •

Developers with solid programming experience but little or no recent C. Delegates must have solid experience of another modern high-level language, including writing and using Functions/procedures/subroutines Knowledge of structured data types such as arrays, structs or records An understanding of scoped variables (i.e local vs. global data). Delegates with less than four months of recent C programming may find this course more appropriate than C++ for C Programmers. Delegates with less than six months of programming experience or with a mainframe background should first attend the C++ Primer course and follow it up with some practical work.

1 | C++ Programming

©2011 IT Education


Course information

C++ Programming for (non C) Programmers

Workshop overview

1. Introduction 1.1. 1.2. 1.3. 1.4. 1.5.

Course Course Course Course Course

Prerequisites Objectives Delivery Practicals Structure

2. C++ Programs 2.1. 2.2. 2.3. 2.4. 2.5. 2.6.

Key features of C++ Identifiers and keywords Simple declarations, expressions and statements Basic I/O Layout Guidelines

3. Fundamental Data Types 3.1. 3.2. 3.3. 3.4. 3.5. 3.6. 3.7. 3.8. 3.9. 3.10.

Built-in types Integer numbers Floating Point numbers Characters Booleans Assignment Compound Assignment Increment and Decrement Defining constants Type conversions

4. Composite Data Types 4.1. 4.2. 4.3. 4.4. 4.5. 4.6.

Defining and using enumerations Built-in arrays and their limitations Using the vector class Built-in strings as character arrays Using the string class Defining and using structures

2 | C++ Programming

Š2011 IT Education


Course information

C++ Programming for (non C) Programmers

5. Control Flow 5.1. 5.2. 5.3. 5.4.

Simple and compound statements Selection with if else and switch statements Conditional expressions Looping with while and for statements

6. Functions 6.1. 6.2. 6.3. 6.4. 6.5. 6.6. 6.7. 6.8. 6.9.

Declaring, calling and defining functions Overloading Default arguments Scope issues Pass by copy Pass by reference Inline functions Header files and source files Pitfalls and guidelines

7. Object Concepts 7.1. 7.2. 7.3. 7.4. 7.5.

Object behaviour Object state Object identity, Object-oriented programming Classes Encapsulation

8. Using Classes 8.1. 8.2. 8.3. 8.4. 8.5.

Associating functionality with data Class definitions Public and private Queries functions and modifier functions Struct vs class

9. Pointers 9.1. 9.2. 9.3. 9.4. 9.5.

Concepts and syntax Pointers to structured types Pointers for encapsulated objects Null pointers Pointers vs. references

3 | C++ Programming

Š2011 IT Education


Course information

C++ Programming for (non C) Programmers

10. Implementing Classes 10.1. 10.2. 10.3. 10.4. 10.5. 10.6. 10.7. 10.8. 10.9.

Defining member functions Object identity The this pointer Initialisation Constructors Default constructors Member Initialisation Scope issues Inlining member functions

11. Operator Functions 11.1. 11.2. 11.3. 11.4. 11.5.

Operators as functions Global operators Member operators I/O stream operators Pitfalls and guidelines

12. Object Relationships 12.1. 12.2. 12.3. 12.4. 12.5.

Associations and their implementation Compositions and their implementation Navigation Delegation Multiplicity

13. Dynamic Memory 13.1. 13.2. 13.3. 13.4. 13.5. 13.6.

The need for dynamic memory Dynamic objects Using new and delete Dynamic arrays; Using new[] and delete[] Destructors

14. More Pointers 14.1. 14.2. 14.3. 14.4.

Pointers and arrays Pointer arithmetic Pointers as array iterators Pointers and const

4 | C++ Programming

Š2011 IT Education


Course information

C++ Programming for (non C) Programmers

14.5.

Pointers vs. references

15. Containers 15.1. 15.2. 15.3. 15.4. 15.5. 15.6. 15.7. 15.8.

Container concepts and classification Template classes Standard containers Vector List Iterators Template functions Algorithms

16. Copying 16.1. 16.2. 16.3. 16.4. 16.5. 16.6. 16.7.

Copy construction Copy assignment Compiler generated copy behaviour Problems Solutions Reducing Copying Restricting Copying

17. Class Relationships 17.1. 17.2. 17.3. 17.4.

Extension of existing classes using inheritance Polymorphic behaviour Type substitutability Abstract base classes

18. Inheritance 18.1. 18.2. 18.3. 18.4. 18.5. 18.6.

Protected members Substitutability Scoping Base class initialisation Order of object construction and destruction Guidelines

5 | C++ Programming

Š2011 IT Education


Course information

C++ Programming for (non C) Programmers

19. Polymorphism 19.1. 19.2. 19.3. 19.4. 19.5.

Declaring and defining virtual functions Virtual destructors Pure virtual functions Using polymorphism through pointers and references Guidelines

P.O. Box 88 · 3750 GB Bunschoten · The Netherlands +31.33.44.80.160 · info@iteducation.nl · www.iteducation.nl Trade Register: 32147657 · VAT: NL0681.57.897.B01 · ING Bank: 4238201

6 | C++ Programming

©2011 IT Education

C++ Programming for (non C) Programmers  

The C++ for (non C) Programmers course provides thorough practical and theoretical coverage of the C++ language for the experienced applicat...