C++ Inheritance & Polymorphism: Pure Virtual Functions & Abstract Classes

C++    |    Intermediate
  • 10 videos | 1h 21m 54s
  • Includes Assessment
  • Earns a Badge
Rating 4.6 of 7 users Rating 4.6 of 7 users (7)
Pure virtual functions and interfaces are very powerful tools in object-oriented programming, and interface-driven programming is a great way of splitting up work across different developers on a large project. You will start this course by considering why your destructors should be marked as virtual in the base class if you have an inheritance hierarchy. You'll see the harmful effects of not using virtual destructors in an inheritance hierarchy and the problems with object slicing. You will also learn why it is preferable to have variables of reference types to the base class rather than the value types. You will then move to some finer points of working with virtual methods, such as, the inadvisability of using default parameters because these are statically bound. Finally, you will master the syntax and semantics of pure virtual functions and learn how a class that contains even one pure virtual function becomes an abstract class that cannot be instantiated directly.

WHAT YOU WILL LEARN

  • Discover the key concepts covered in this course
    Enable runtime polymorphism by marking destructors as virtual
    Identify scenarios in which object slicing can occur
    Recall that default input arguments should not be specified in virtual functions
    Recognize how virtual methods invoked from constructors and destructors are statically dispatched
  • Use the scope resolution operator to invoke specific versions of virtual methods
    Define and invoke pure virtual functions
    Outline the concept of abstract classes
    Create pure abstract classes in c++
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 2m 10s
  • 11m 30s
  • Locked
    3.  Understanding Object Slicing
    11m 17s
  • Locked
    4.  Exploring Default Arguments to Virtual Functions
    9m 29s
  • Locked
    5.  Using Virtual Methods in Constructors & Destructors
    8m 34s
  • Locked
    6.  Exploring the '::' Operator
    8m 41s
  • Locked
    7.  Using Pure Virtual Functions
    10m 5s
  • Locked
    8.  Exploring Abstract Classes
    7m 46s
  • Locked
    9.  Using Interfaces
    9m 39s
  • Locked
    10.  Course Summary
    2m 42s

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.

YOU MIGHT ALSO LIKE

Rating 4.4 of 9 users Rating 4.4 of 9 users (9)
Rating 4.0 of 7 users Rating 4.0 of 7 users (7)
Rating 4.4 of 8 users Rating 4.4 of 8 users (8)

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.7 of 14 users Rating 4.7 of 14 users (14)
Rating 4.4 of 8 users Rating 4.4 of 8 users (8)
Rating 4.1 of 9 users Rating 4.1 of 9 users (9)