EEC Logo

Introduction to C++ Programming

Duration: 4 or 5 days (see Prerequisites, below)

Audience

Software engineers, programmers, and analysts who will be designing and creating programs using C++. Anyone desiring the ability to read and understand C++ programs for maintenance and update purposes.

This course provides an intense introduction to C++ programming but the serious student will want to investigate other topics as well, such as object-oriented analysis and design (OOA&D), generic algorithms, and template metaprogramming.

Course Contents

  1. Moving to C++

    1. The Hello World program

    2. Using the string Class

    3. IO Using Streams

      1. Standard Output Stream

      2. Standard Input Stream

      3. Formatted IO Using Streams

      4. Manipulator IO Example

      5. Another Manipulator IO Example

      6. Stream Notes

    4. C++ Comment Format

    5. Changes in Functions

      1. Function Prototypes

      2. Function Definitions

      3. Example: Calc.CPP

    6. Constants - #define vs. const

    7. Overview of C++ Extensions to C

      1. Declaration Placement

      2. Default Function Arguments

      3. Scope Resolution Operator

      4. inline Functions

      5. Overloaded Functions

      6. Examples of Using Overloading

    8. C Linkage

  2. Class Fundamentals

    1. Classes

    2. Standard C Structure

    3. C++ Class vs. C Structure

    4. Uses for a Class

    5. Defining a Class

    6. Example

      1. Animal1.H (Interface)

      2. Animal1.CPP (Implementation)

      3. Main1.CPP (Application)

    7. C++ File Organization

    8. Class Access Attributes

    9. References vs. Pointers

    10. Example: Refer1.CPP

    11. Constructors and Destructors

    12. Example

      1. Animal2.H (Interface)

      2. Animal2.CPP (Implementation)

      3. Main2.CPP (Application)

    13. Member Access Functions

    14. Operator Precedence

    15. Scope in C++

    16. new and delete Operators

    17. Overloaded Member Functions

    18. Example

      1. Animal3.H (Interface)

      2. Animal3.CPP (Implementation)

      3. Main3.CPP (Application)

    19. Class Usage Tips

  3. Object-Oriented Design

    1. OOD Design and Development

    2. System Structure

      • 1. Be Broken Down Into Components

        • a. Information Hiding

        • b. What Should Be Hidden?

        • c. Advantages of Modularity

        • d. How Do We Modularize?

        • e. Modularization Clues

      • 2. Have Limited Interactions

        • a. Cohesion

        • b. Coupling

      • 3. Be Structured Hierarchically

        • Class Reorganization

    3. Recap of the Major Steps in OOD

      1. Identifying the Classes

      2. Refine the Classes via Methods

      3. Refine the Classes via Dependencies

      4. Defining the Interface

    4. Interface Definition Rule-of-Thumb

    5. General Rules of Software Design and Development

    6. Critical Items To Consider

  4. Advanced Classes

    1. Base Classes

    2. Derived Classes

      1. Inheritance

      2. Construction and Destruction of Derived Classes

      3. An Inheritance Example

      4. Employee and Boss

    3. Access Control (private, protected, public)

      1. Private Member Information

      2. Protected Member Information

      3. Access to Base Classes

    4. Multiple Inheritance

    5. The friend Keyword

      1. Friend Functions

      2. Friend Classes

      3. Friendship Among Classes (not transitive nor associative)

      4. Friends and Iterators

      5. Example

        1. Record.H (Interface)

        2. PhoneList.H (Interface)

        3. SLList.H (Interface)

        4. PhoneList.CPP (Implementation)

        5. PhoneMain.CPP (Application)

  5. Advanced Topics

    1. Virtual Functions

      1. Detailed Example

    2. Virtual Classes

      1. Detailed Example

    3. Proper Design - Functional Separation

    4. The static Keyword

      1. Static Data Members

      2. Initializing and Using Static Data Members

      3. Static Function Members

    5. Pure Virtual Functions and Abstract Classes

    6. Implementation Hiding

    7. Operator Overloading

    8. Example

      1. Oper1.H (Interface)

      2. Oper1.CPP (Implementation)

    9. Understanding Templates

Course Objectives

Upon completion of this course, the student will be able to:

Instructional Technique

Students are invited to bring their current ideas and questions to the classroom for discussion. Lecture, group problem solving, and online laboratories will be used. Students will be encouraged to enhance their skills utilizing the techniques presented through classroom problem solving and controlled online workshops. This course is approximately 50% labwork.

This course does not concentrate on the use of any one particular development tool. Instead, the students are encouraged to learn the proper design and implementation techniques by hand-coding their applications. If development tools are available in the classroom, the instructor will demonstrate their use and guide the students in the use of such tools.

Prerequisites

Experience in C, Java, Pascal, or another compiled programming language with primitive data types is required. If you have any doubts about whether you meet this requirement, visit our Online C Language Review (see below).

This course can be offered as 5 days, with a single day of C language refresher and labs prepended. This refresher does not teach the entire C language, but will cover enough of the details for this C++ course to be completed. Example topics in the refresher include basic data types, loop constructs, background on pointers, user-defined data structures, and how to produce formatted output.

Online C Language Review

A selection of background questions is given below. Instructions for interpreting the results are given on the same page.

Background questions.