+ 1
Is template and a function similar?
what is the difference between them?
14 odpowiedzi
+ 4
see example.
in example. variable output can be anything
when we supply a std::string to output variable. the compiler creates a function for that type.
void jSays(const std::string output);
if we supply an int the compiler will create a function that accepts type int.
void jSays(const int output);
+ 4
Australia
+ 4
lol. So I have been told 😊
+ 3
template is a template. It is an outline of a thing. Its structure.
a function is a function.
A templated function is a function that can accept many different data types. think overloading but without the overloading.
+ 3
typename
+ 2
your name is like an Indian that's why
+ 1
@jay so template is a function where it can accept all data types right??
+ 1
ok
+ 1
where are you from
+ 1
can you say the keyword that declares a variable which can accept any datatype??
+ 1
ok thank you
+ 1
where are you frim
+ 1
ok