Jump to content

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<classtypename T>
class tree {
{
T value;
tree *left;
Line 212 ⟶ 211:
 
<syntaxhighlight lang="cpp">template<class T>
void tree<T>::replace_all (T new_value) {
{
value = new_value;
if (left != NULLnullptr)
left->replace_all (new_value);
if (right != NULLnullptr)
right->replace_all (new_value);
}</syntaxhighlight>
 
3

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.