I don't know why C++ compiler run the base class method (sort method of class Sorting) instead of derived class method (sort method of class SelectionSort).
template <typename T>
class Sorting {
public:
    virtual void sort(T* data, int size, Comparator<T> comparator) const {
    };
};
template <typename T>
class SelectionSort : public Sorting<T> {
public:
    void sort(T* data, int size, Comparator<T> comparator) {
        // my selection sort code
    };
};
template <typename T>
void Array<T>::sort(Sorting<T> algorithm, Comparator<T> comparator) {
    algorithm.sort(data, size, comparator); /// Problem is here !
};
int main() {
    int nums[] = { 2, 1, 3 };
    Array<int> arr(nums, 3);
    SelectionSort<int> sorting = SelectionSort<int>();
    AscendingComparator<int> comparator = AscendingComparator<int>();
    arr.sort(sorting, comparator);
    return 0;
}
 
     
    