C++ Object-Oriented Programming

This class covers an in depth look at how C++ is utilized in Object Oriented programs

Overview

This class covers an in depth look at how C++ is utilized in Object Oriented programs

Audience

Programming experience is preferred

Length

32 hours

Outline

Introduction & Overview

  • Why C++?
  • Object-oriented programming
  • Object-oriented Terminology

Benefits of object-oriented programming

  • How O-O design improves productivity
  • Reusability
  • Reliability and maintainability

C++ and object oriented programming

  • Limitation of C as an O-O language
  • Design goals of C++
  • Moving from C to C++

The structure of a C++ program

  • Source program names
  • C++ syntax
  • Commenting a program source
  • Function specifications and declarations
  • Local variables declarations
  • Initialization and declaration of global variables
  • Assignment of pointers of type void *
  • The const keyword
  • Miscellaneous items
  • C and C++ keywords

Classes in C++

  • The purpose of a class
  • Components of a class
  • Class declaration
  • Member functions
  • Data members
  • Encapsulation
  • Source Code
  • The unary form of the scope resolution operator
  • Creating instances of a class
  • Accessing data members

Constructors and Destructors

  • Constructors
  • Destructors
  • Why constructors and Destructors are needed?
  • When the constructor function is called
  • When the destructor function is called

Dynamic memory allocation

  • The operator new
  • The operator delete
  • Allocating user-defined instances from the heap

Reference variables

  • Creation of a reference variable and initialization
  • Adders of a reference variable
  • The benefit of using reference variables

Copy constructors

  • Enumerated types
  • Enumerated types with classes

Using const to improve reliability and efficiency

  • Constant class member functions
  • Constant instances
  • Constant reference to instances

The this pointer

Friend functions

  • Granting friendship to another class
  • Granting friendship to a member of another class

TYPES CONVERSIONS

  • Types of casts
  • Different styles of explicit casting
  • Casting possibilities
  • Casting from built-in types to user-defined types
  • Casting from user-defined types to built-in types
  • Casting between user-defined types

POLYMORPHISM

  • The importance of polymorphism
  • Static vs Dynamic binding
  • Virtual functions
  • Virtual function redefinition (function overriding)
  • Virtual destructor functions
  • ExerPure virtual functions
  • How virtual functions work
  • Abstract base classes
  • Virtual inheritance

C++ I/O STREAMS

  • Why switch to something new?
  • C++ input/output classes
  • Instances of the istream/ostream classes
  • The insertion operator
  • The extraction operator
  • Input/output formatting

Output formatting

  • Bit format flag
  • How to turn on the bit format flags
  • How to turn off the bit format flags
  • Displaying formatted integers
  • Specifying the field width, the fill character, and field justification
  • Displaying floating point numbers

Input formatting

  • Integer input
  • Character input
  • String input
  • Checking for errors
  • Checking the input stream buffer
  • An I/O concluding example
  • I/O formatting using manipulators
  • Built-in manipulators
  • An example of built-in manipulators
  • File input/output
  • Opening a file
  • Checking for open failure
  • An example of reading, writing, and appending
  • The file position marker
  • Changing the file position markers
  • Reading the file position markers

How to hide file I/O from the user

  • Two classes having the same friend function

Inline functions

  • Class inheritance
  • Private derivation
  • Public derivation
  • Protected access rights
  • Protected derivation
  • Accessing base class members

Defaults function arguments

  • The benefit of default arguments
  • Mandatory and default arguments

The base/member initialize list

  • When the base/member initialize list is mandatory

Multiple inheritance

Function overloading

  • Type-safe-linkage

Overloading operators

  • Overloading a binary operator as a member function
  • Overloading a unary operator as a member function
  • Rules for operators overloading
  • Overloading a binary operator as a friend function
  • Overloading a unary operator as a friend function
  • The usefulness of friend functions