{"id":84047,"date":"2021-09-11T09:00:08","date_gmt":"2021-09-11T03:30:08","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=84047"},"modified":"2021-09-11T09:00:08","modified_gmt":"2021-09-11T03:30:08","slug":"cpp-templates","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/","title":{"rendered":"C++ Templates with Examples"},"content":{"rendered":"<p>The C++ programming languages offer some exciting and useful features to the programmers. You can perform various awesome things with C++. In C++, It is one of the most efficient and useful features. Using Templates, you can write generic programs in C++. Let us learn more about C++ templates.<\/p>\n<h3>What are Templates in C++?<\/h3>\n<p>To put it short, using Templates, you can write a single function or a class to work with different data types. It is a powerful tool to use. With the help of templates, you can pass the data type as a parameter. With this, you don\u2019t have to write the same code for different data types.<\/p>\n<p>Suppose, in a company, you have to sort() for different data types. So, for this, you can write one sort() and pass data type as a parameter.<\/p>\n<p>In C++, Templates can be represented in two ways:-<\/p>\n<ul>\n<li>Function templates<\/li>\n<li>Class templates<\/li>\n<\/ul>\n<h3>1. Function Templates in C++<\/h3>\n<p>You can define a template for a function. It works similarly like a function but it has one key difference. A normal function can work with one set of data types. But with the help of templates, you can work with different data types at once. Using Templates, you can perform the task while writing less and maintainable code.<\/p>\n<p><strong>Syntax of C++ Function Template<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">template &lt; class type&gt; return_type_functionName(parameters)  {  \n\/\/ body  \n} \n<\/pre>\n<p>Above, type is a placeholder name for the data type that is used by the function. The placeholder will automatically get replaced with the actual data type by the compiler.<\/p>\n<p><strong>Example of Simple Function Template in C++<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;  \nusing namespace std;  \ntemplate&lt;class T&gt; T add(T &amp;i,T &amp;j)  \n{  \n  T res = i+j;  \n  return res;\n}  \nint main()  \n{  \n  int x =2;  \n  int y =3;  \n  cout&lt;&lt;\"The value of the addition of is: \"&lt;&lt;add(x,y);  \n  return 0;  \n}\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">The value of the addition of is: 5<\/div>\n<p>Above, we created a function() add which will perform addition on any data type.<\/p>\n<h4>Function Templates with Multiple Parameters<\/h4>\n<p>You can also use multiple parameters in your function template.<\/p>\n<p><strong>Syntax:-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">template&lt;class T1, class T2,.....&gt;  \nreturn_type functionName (arguments of type T1, T2....)  {  \n    \/\/ body  \n} \n<\/pre>\n<p>The above syntax will accept any number of arguments of different types.<\/p>\n<p><strong>Example of Function Template with multiple parameters<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;  \nusing namespace std;  \ntemplate&lt;class A,class B&gt; void func(A x,B y)  \n{  \nstd::cout &lt;&lt; \"Value-&gt;x: \" &lt;&lt;x&lt;&lt; std::endl;  \nstd::cout &lt;&lt; \"Value-&gt;y: \" &lt;&lt;y&lt;&lt; std::endl;  \n}  \nint main()  \n{  \nfunc(15.2,1.3);  \nreturn 0;  \n}\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">Value-&gt;x: 15.2<br \/>\nValue-&gt;y: 1.3<\/div>\n<p>Above, we used two generic types such as A and B in the template function.<\/p>\n<h3>Overloading a function Template in C++<\/h3>\n<p>You can also overload a function template in C++.<\/p>\n<p><strong>Example of Function Template Overload<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;  \nusing namespace std;  \ntemplate&lt;class A&gt; void func(A x)  \n{  \n  std::cout &lt;&lt; \"Value-&gt;x: \" &lt;&lt;x&lt;&lt; std::endl;  \n}  \ntemplate&lt;class A,class B&gt; void func(A y ,B z)  \n{  \n  std::cout &lt;&lt; \"Value-&gt;y: \" &lt;&lt;y&lt;&lt; std::endl;  \n  std::cout &lt;&lt; \"Value-&gt;z: \" &lt;&lt;z&lt;&lt; std::endl;  \n}  \nint main()  \n{  \n   func(20);  \n   func(2,2.1);  \n   return 0;  \n}\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">Value-&gt;x: 20<br \/>\nValue-&gt;y: 2<br \/>\nValue-&gt;z: 2.1<\/div>\n<p>Above, the func() function is overloaded.<\/p>\n<h3>Generic Functions Restrictions<\/h3>\n<p>It is the same as the normal function but for generic functions, the data type differs. Let\u2019s take a simple example below:-<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;  \nusing namespace std;  \nvoid func(double x)  \n{  \n  cout&lt;&lt;\"value of x is : \"&lt;&lt;x&lt;&lt;'\\n';  \n}  \n \nvoid func(int y)  \n{  \n  if(y%2==0)  \n  {  \n    \tcout&lt;&lt;\"The Number is even!\";  \n  }  \n  else  \n  {  \n    \tcout&lt;&lt;\"The Number is odd!\";  \n  }  \n \n}  \n \nint main()  \n{  \n   func(3.2);  \n   func(5);  \n   return 0;  \n}\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">value of x is : 3.2<br \/>\nThe Number is odd!<\/div>\n<p>Above, we have just overloaded the normal functions. But we cannot overload the generic functions because both the functions have different functionalities.<\/p>\n<h3>Class Template in C++<\/h3>\n<p>You can also create class templates similarly like function templates.<\/p>\n<p>In some cases, you will need a class implementation that is the same for all the classes. The only thing is that the data types that are used are different. Generally, you would have to create a class for each data type. And because of that, your code will get complex and hard to understand.<\/p>\n<p>To avoid that, you can make use of class templates. Using class templates, you can reuse the same code for all data types.<\/p>\n<p><strong>Syntax of C++ Class Template:-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">template &lt;class T&gt;\nclass Name_of_the_class\n{\n   ... .. ...\n   ... .. ...\n};\n<\/pre>\n<p>From above, T is a placeholder for the data type used. It is also known as the template argument.<\/p>\n<h4>Create a class template object<\/h4>\n<p>If you want to create a class template object then you will have to define the data type inside &lt;&gt; during creation.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Name_of_the_class&lt;dataType&gt; class_Object;<\/pre>\n<p><strong>Example:-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Name_of_the_class&lt;int&gt; class_Object;\nName_of_the_class&lt;float&gt; class_Object;\n<\/pre>\n<p><strong>Example:- Class Template<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;  \nusing namespace std;  \ntemplate&lt;class T&gt;  \nclass Add  \n{  \n  public:  \n  T n1 = 6;  \n  T n2 = 1;  \n  void addition()  \n  {  \n    \tstd::cout &lt;&lt; \"n1+n2: \" &lt;&lt; n1+n2&lt;&lt;std::endl;  \n  }  \n \t \n};  \nint main()  \n{  \n  Add&lt;int&gt; data;  \n  data.addition();  \n  return 0;  \n}\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">n1+n2: 7<\/div>\n<p>Above, we created a template for class Add and within the main() function, we created the instance of class Add.<\/p>\n<h4>C++ Class Template with multiple parameters<\/h4>\n<p>You can also use multiple parameters in your class template.<br \/>\n<strong>Syntax:-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">template&lt;class T1, class T2, ......&gt;   \nclass Name_of_the_class \n{  \n   \/\/ Body \n}\n<\/pre>\n<p><strong>Example:- Class Template with multiple parameters<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;  \nusing namespace std;  \ntemplate&lt;class T1, class T2&gt;  \nclass Tech  \n{  \nT1 x;  \nT2 y;  \npublic:  \nTech(T1 a,T2 b)  \n{  \nx = a;  \ny = b;  \n}  \nvoid print()  \n{  \nstd::cout &lt;&lt; \"The values of x and y: \" &lt;&lt; x&lt;&lt;\" and \"&lt;&lt;y&lt;&lt;std::endl;  \n}  \n};  \nint main()  \n{  \nTech&lt;int,float&gt; data(5,2.3);  \ndata.print();  \nreturn 0;  \n}\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">The values of x and y: 5 and 2.3<\/div>\n<h3>Non type Template Arguments in C++<\/h3>\n<p>In template arguments, we can also use non-type template arguments. We can also use other types of arguments like strings, function names, constant names, built-in types.<\/p>\n<p><strong>Example:-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">template&lt;class T, int element&gt;  \nclass exp  \n{  \nT a[element];            \n};\n<\/pre>\n<p>In above example, element is the non-type template argument. You can specify arguments while creating the objects of the class:-<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">exp&lt;int, 15&gt; t1;                        \nexp&lt;float, 10&gt; t2;\n<\/pre>\n<p><strong>Example:- Non-type Template argument<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;  \nusing namespace std;  \ntemplate&lt;class T, int element&gt;  \nclass Exp   \n{  \n  public:  \n  T a[element];  \n  void put()  \n  {  \n    \tint x =1;  \n    \tfor (int j=0;j&lt;element;j++)  \n    \t{  \n        \ta[j] = x;  \n        \tx++;  \n    \t}  \n  }  \n \t \n  void print()  \n  {  \n    \tfor(int x=6;x&lt;element;x++)  \n    \t{  \n        \tstd::cout &lt;&lt; a[x] &lt;&lt; \" \";  \n    \t}  \n  }  \n};  \nint main()  \n{  \n  Exp&lt;int,16&gt; t1;  \n  t1.put();  \n  t1.print();  \n  return 0;  \n}\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">7 8 9 10 11 12 13 14 15 16<\/div>\n<h3>How template works in C++?<\/h3>\n<p>Templates are like macros that are expanded at compile time. The only difference is that before template expansion, the compiler does type checking. The source code will only contain the function or class but the compiled code will contain multiple copies of the same function or class.<\/p>\n<h3>Difference between C++ function overloading and templates<\/h3>\n<p>Let me tell you that function overloading and function templates are examples of polymorphism which is one of the most useful features of OOP. We use function templates when multiple functions perform identical operations. And we use function overloading when multiple functions perform similar operations.<\/p>\n<h3>What is Template Specialization in C++?<\/h3>\n<p>With the help of template specialization, you can write different code for a specific data type.<\/p>\n<h3>Default value for template arguments<\/h3>\n<p>You can also specify default arguments to templates.<br \/>\n<strong>Example:-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include&lt;iostream&gt;\nusing namespace std;\ntemplate&lt;class T1, class T2 = char&gt;\nclass Tech{\npublic:\n  T1 x;\n  T2 y;\n  Tech() {   cout&lt;&lt;\"C++ Templates!\"&lt;&lt;endl;   }\n};\n \nint main()  {\n   Tech&lt;char&gt; a;  \n   return 0;\n}\n<\/pre>\n<p><strong>Output:-<\/strong><\/p>\n<div class=\"code-output\">C++ Templates!<\/div>\n<h3>Importance of C++ Templates<\/h3>\n<p>There are various ways why you should use templates in C++.<\/p>\n<ul>\n<li>Less Redundancy:- Suppose, you want to find the area of a rectangle with parameters entered as integer and as well as floating point values. Then without any difficulty, you can achieve this task with the help of templates. You don\u2019t have to create different functions for integer and floating point values.<\/li>\n<li>Programming Effort Reduced:- You can use multiple blocks of code for multiple data types. It will reduce the programming effort on the user\u2019s end.<\/li>\n<li>Reusability and Flexibility:- It provides the reusability of codes which you can use again. It also provides you code flexibility.<\/li>\n<li>Utility:- You can also combine templates with function overloading and multiple inheritance.<\/li>\n<\/ul>\n<h3>Summary<\/h3>\n<p>In this tutorial, we discussed C++ templates and their working. We also discussed function and class templates and the difference between function templates and overloading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The C++ programming languages offer some exciting and useful features to the programmers. You can perform various awesome things with C++. In C++, It is one of the most efficient and useful features. Using&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":84624,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3405],"tags":[4213,4214],"class_list":["post-84047","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cpp","tag-c-templates","tag-importance-of-c-templates"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>C++ Templates with Examples - TechVidvan<\/title>\n<meta name=\"description\" content=\"Learn C++ templates &amp; their working. See function and class templates and the difference between function templates and overloading.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++ Templates with Examples - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Learn C++ templates &amp; their working. See function and class templates and the difference between function templates and overloading.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-11T03:30:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/C-Templates.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C++ Templates with Examples - TechVidvan","description":"Learn C++ templates & their working. See function and class templates and the difference between function templates and overloading.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/","og_locale":"en_US","og_type":"article","og_title":"C++ Templates with Examples - TechVidvan","og_description":"Learn C++ templates & their working. See function and class templates and the difference between function templates and overloading.","og_url":"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2021-09-11T03:30:08+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/C-Templates.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"C++ Templates with Examples","datePublished":"2021-09-11T03:30:08+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/"},"wordCount":1009,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/C-Templates.jpg","keywords":["C++ Templates","Importance of C++ Templates"],"articleSection":["C++ Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/cpp-templates\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/","url":"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/","name":"C++ Templates with Examples - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/C-Templates.jpg","datePublished":"2021-09-11T03:30:08+00:00","description":"Learn C++ templates & their working. See function and class templates and the difference between function templates and overloading.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/cpp-templates\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/C-Templates.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/08\/C-Templates.jpg","width":1200,"height":628,"caption":"C++ Templates"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/cpp-templates\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"C++ Templates with Examples"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/84047","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=84047"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/84047\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/84624"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=84047"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=84047"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=84047"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}