Designing Reusable Code   «Prev  Next»
Lesson 1

Writing Reusable Code in C++

This course teaches you the basics of polymorphism and inheritance, focusing on function and operator overloading and on creating class hierarchies. Throughout the course, you will gain skills that help you build adaptable, reusable, object-oriented C++ code.
After completing this course, you will be able to write C++ programs that:

C++ Polymorphism

Polymorphism is such a powerful feature of object-oriented programming that you will use it in the majority of your C++ programs. Polymorphism requires you to use derived classes, and the content of this module relies heavily on the concepts related to inheritance in derived classes.
In this module you will learn:
What polymorphism is and how you get polymorphic behavior with your classes
  1. What a virtual function is
  2. When and why you need virtual destructors
  3. How default parameter values for virtual functions are used
  4. What a pure virtual function is
  5. What an abstract class is
  6. How you cast between class types in a hierarchy
  7. How you determine the type of an object passed to a function as the argument for a parameter that is a reference to a base class
  8. What pointers to members are, and how you use them

Course Goals

  1. Use special conversion member functions to convert from a user-defined type to a built-in type
  2. Overload operators and member functions to give them additional meanings
  3. Use derived classes, virtual functions, and abstract base classes to create class hierarchies
First-time students: To get the most out of this course, visit the Sitemap tab.
Algorithms must be implemented in a programming language. Thus this course includes some coverage of C++, especially the more advanced topics not usually covered in a first course and which students need to learn. These include recursion, function and class templates, inheritance, and polymorphism. The C++ features presented conform to the official standard for C++. In addition, some of the C-style topics appropriate in a data structures course are included for several reasons. Data structures provided in C are usually implemented very efficiently and they are often used to implement some of the more modern standard data types.