
Object-Oriented Programming and C++ 51
polymorphism and parametric polymorphism is called static polymorphism.
Dynamic polymorphism is achieved by virtual functions and static polymor-
phism is achieved by templates. In terms of flexibility, dynamic polymorphism
is better than static polymorphism. In terms of performance, static polymor-
phism is better than dynamic polymorphism.
3.5.1 Dynamic Polymorphism
To illustrate the idea of dynamic polymorphism in C++, we consider the
example of clustering algorithms. In data clustering, there are many clustering
algorithm. It is a good idea to have a common base for all these clustering
algorithms. The Algorithm ...