一方で
>>785
>namespace Shape {
> struct Circle {uint32_t r;};
> struct Rectangle {uint32_t w; uint32_t h;};
> struct Parallelogram {uint32_t ui0; uint32_t ui1;};
> template <typename T> void function (ostream &os, const T &p) {}
> void function (ostream &os, const Circle &p) {}
> void function (ostream &os, const Rectangle &p) {}
>}
上記のどのfunctionが呼ばれるかは型に基づいてコンパイル時に選択される
これが静的ディスパッチ