RosettaCodeData/Task/Parametric-polymorphism/C++/parametric-polymorphism-2.cpp

10 lines
195 B
C++
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
template<class T>
void tree<T>::replace_all (T new_value)
{
value = new_value;
if (left != NULL)
left->replace_all (new_value);
if (right != NULL)
right->replace_all (new_value);
}