ITP 165x Lecture Notes - Lecture 23: Virtual Function, Calcareous Sponge
Document Summary
Itp 165: intro to c++ - lecture 23, pure virtual functions, abstract classes. So conceptually, we could make a shape class and say: We want to put all the common functionality into shape. A virtual function is one that child classes can override: The = 0 means that all children of shape are required to implement this function. When you create a class that has a pure virtual function, it is called an abstract class. We call these classes abstract, because they have member functions that cannot be implemented. You cannot create instances of these classes. Classes that have all their member functions defined are called concrete classes. Without virtual functions, we could not create a single collection class like a vector that contains objects of different classes that inherit from the same base class. We would have to have a collection of each derived type.