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

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

2013-04-10 23:57:08 -07:00
template<class T>
void tree<T>::replace_all (T new_value)
{
value = new_value;
2015-02-20 00:35:01 -05:00
if (left != NULL)
left->replace_all (new_value);
if (right != NULL)
right->replace_all (new_value);
2013-04-10 23:57:08 -07:00
}