Behavioral Design ◾ 201
not provide a keyword. Instead, the idea of “initializing a function to
zero”isemphasized. By setting the function header of a virtual function
“=0;”, a class designer species a virtual function without a denition,
that is, a pure virtual function. Any function that has no implementa-
tion is abstract and depends on derived classes to provide implementation
details. Since it has no implementation, a pure virtual function has an
entry in the class vtab initialized with the value “0.”
Example 7.14: C# Abstract Class
abstract class Shape // abstract easily noted with keyword
{ public virtual void rotate(int);
public virtual void draw();
…
}
In the classic Example 7.12, the Shape class is an abstract class and