Parametric polymorphism: Difference between revisions
m
→{{header|C++}}: formatting and nullptr instead of NULL
m (→{{header|Wren}}: Changed to Wren S/H) |
m (→{{header|C++}}: formatting and nullptr instead of NULL) |
||
Line 199:
=={{header|C++}}==
<syntaxhighlight lang="cpp">template<
class tree {
T value;
tree *left;
Line 212 ⟶ 211:
<syntaxhighlight lang="cpp">template<class T>
void tree<T>::replace_all
value = new_value;
if (left !=
left->replace_all
if (right !=
right->replace_all
}</syntaxhighlight>
|