From 94ff20672ec14e558fa6341327a45c33438314fe Mon Sep 17 00:00:00 2001 From: Rishabh <53911515+Rishabh672003@users.noreply.github.com> Date: Thu, 14 Dec 2023 10:31:30 +0530 Subject: [PATCH] fixed some stuff --- CPP/34-templates.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CPP/34-templates.md b/CPP/34-templates.md index 12153bd..2f501d7 100644 --- a/CPP/34-templates.md +++ b/CPP/34-templates.md @@ -11,10 +11,14 @@ prints out the value of an object of any type: ```cpp template void print(T value) { std::cout << value << std::endl; } + +print(1); +print("Hello"); +print(5.3); ``` In the above code, `T` is a placeholder for any data type. When you call the `print` function, you can pass an object of -any type, and the `print` function will print out the value of the object. +any type for which operator `<<` is overloaded, and the `print` function will print out the value of the object. **Class Templates**