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:
Polymorphism is such a powerful feature of object-oriented programming that you will use it in the majority of your C++ programs.
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:
is and how you get polymorphic behavior with your classes
- What a virtual function is
- When and why you need virtual destructors
- How default parameter values for virtual functions are used
- What a pure virtual function is
- What an abstract class is
- How you cast between class types in a hierarchy
- 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
- What pointers to members are, and how you use them
- Use special conversion member functions to convert from a user-defined type to a built-in type
- Overload operators and member functions to give them additional meanings
- 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
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.