{"id":1981,"date":"2020-05-09T20:29:01","date_gmt":"2020-05-09T14:59:01","guid":{"rendered":"https:\/\/www.rangakrish.com\/?p=1981"},"modified":"2020-05-09T20:32:58","modified_gmt":"2020-05-09T15:02:58","slug":"dynamic_cast-vs-stdis_base_of","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2020\/05\/09\/dynamic_cast-vs-stdis_base_of\/","title":{"rendered":"dynamic_cast<> vs. std::is_base_of<>"},"content":{"rendered":"<p>In the <a href=\"https:\/\/www.rangakrish.com\/index.php\/2020\/04\/26\/stdis_base_of\/\" target=\"_blank\" rel=\"noopener\"><em><strong>last article<\/strong><\/em><\/a>, we looked at the <em><strong>std:is_base_of&lt;T1, T2&gt;<\/strong><\/em> type trait. One question that a reader asked since that article appeared is <em><strong>&#8220;How does <span style=\"color: #0000ff;\">is_base_of&lt;&gt;<\/span> differ from the <span style=\"color: #0000ff;\">dynamic_cast&lt;&gt;<\/span> operator?&#8221;<\/strong><\/em><\/p>\n<p>Good question! In today&#8217;s post let me try to address the key differences between the two.<\/p>\n<p>I am not going to cover the <em><strong>dynamic_cast&lt;&gt;<\/strong><\/em> operator in detail here. I urge you to go through the primary <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/dynamic_cast\" target=\"_blank\" rel=\"noopener\"><em><strong>reference<\/strong><\/em><\/a>.<\/p>\n<p>One of the common uses of <em><strong>dynamic_cast&lt;&gt;<\/strong><\/em> operator is to <em><strong>&#8220;safely&#8221;<\/strong><\/em> cast a pointer to base class type to a pointer to derived class type, provided it is valid. This might require the use of run-time type information (<em><strong>RTTI<\/strong><\/em>).<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p>Contrast this with <em><strong>is_base_of&lt;&gt;<\/strong><\/em>. This works with type names and not object references. To get a better idea, feel free to go through the <a href=\"https:\/\/www.rangakrish.com\/index.php\/2020\/04\/26\/stdis_base_of\/\" target=\"_blank\" rel=\"noopener\"><em><strong>earlier post<\/strong><\/em><\/a>.<\/p>\n<p>Let us look at 4 different cases comparing <em><strong>dynamic_cast&lt;&gt;<\/strong><\/em> and <em><strong>is_base_of&lt;&gt;<\/strong><\/em>.<\/p>\n<h3><\/h3>\n<h3>Case -1: Working with Classes<\/h3>\n<p><em><strong>dynamic_cast&lt;&gt;<\/strong><\/em> can only work with class types, not primitive types. That is not a restriction in the case of <strong>is_base_of&lt;&gt;<\/strong>. See the following example:<\/p>\n<figure id=\"attachment_1982\" aria-describedby=\"caption-attachment-1982\" style=\"width: 593px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case1.jpg?ssl=1\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"1982\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2020\/05\/09\/dynamic_cast-vs-stdis_base_of\/case1\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case1.jpg\" data-orig-size=\"593,402\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Case-1\" data-image-description=\"&lt;p&gt;Case-1&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Case-1&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case1.jpg\" class=\"size-full wp-image-1982\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case1.jpg?resize=593%2C402&#038;ssl=1\" alt=\"Case-1\" width=\"593\" height=\"402\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case1.jpg?w=593&amp;ssl=1 593w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case1.jpg?resize=300%2C203&amp;ssl=1 300w\" sizes=\"(max-width: 593px) 100vw, 593px\" \/><\/a><figcaption id=\"caption-attachment-1982\" class=\"wp-caption-text\"><strong>Case-1<\/strong><\/figcaption><\/figure>\n<p>You can see that <em><strong>dynamic_cast&lt;&gt;<\/strong><\/em> will not accept a non-class argument (line 15).<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<h3>Case-2: Non-polymorphic Class Hierrachy<\/h3>\n<p><em><strong>dynamic_cast&lt;&gt;<\/strong><\/em> expects the argument to refer to a <em><strong>polymorphic<\/strong><\/em> class class, i.e., one that has at least one virtual function. The example below illustrates this point.<\/p>\n<figure id=\"attachment_1983\" aria-describedby=\"caption-attachment-1983\" style=\"width: 629px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case2.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"1983\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2020\/05\/09\/dynamic_cast-vs-stdis_base_of\/case2\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case2.jpg\" data-orig-size=\"629,528\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1589045824&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Case-2\" data-image-description=\"&lt;p&gt;Case-2&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Case-2&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case2.jpg\" class=\"size-full wp-image-1983\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case2.jpg?resize=629%2C528&#038;ssl=1\" alt=\"Case-2\" width=\"629\" height=\"528\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case2.jpg?w=629&amp;ssl=1 629w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case2.jpg?resize=300%2C252&amp;ssl=1 300w\" sizes=\"(max-width: 629px) 100vw, 629px\" \/><\/a><figcaption id=\"caption-attachment-1983\" class=\"wp-caption-text\"><strong>Case-2<\/strong><\/figcaption><\/figure>\n<p><em><strong>is_base_of&lt;&gt;<\/strong><\/em> does not have this limitation.<\/p>\n<h3>Case-3: Polymorphic Class Hierarchy<\/h3>\n<p>This is the common use case for <em><strong>dynamic_cast&lt;&gt;<\/strong><\/em> operator. Go through the following example.<\/p>\n<figure id=\"attachment_1984\" aria-describedby=\"caption-attachment-1984\" style=\"width: 614px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case3.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"1984\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2020\/05\/09\/dynamic_cast-vs-stdis_base_of\/case3\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case3.jpg\" data-orig-size=\"614,633\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1589045889&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Case-3\" data-image-description=\"&lt;p&gt;Case-3&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Case-3&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case3.jpg\" class=\"size-full wp-image-1984\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case3.jpg?resize=614%2C633&#038;ssl=1\" alt=\"Case-3\" width=\"614\" height=\"633\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case3.jpg?w=614&amp;ssl=1 614w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case3.jpg?resize=291%2C300&amp;ssl=1 291w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/a><figcaption id=\"caption-attachment-1984\" class=\"wp-caption-text\"><strong>Case-3: Polymorphic Hierarchy<\/strong><\/figcaption><\/figure>\n<p>This shows how <em><strong>dynamic_cast&lt;&gt;<\/strong><\/em> uses <em><strong>RTTI<\/strong><\/em> to convert a pointer from base class to derived class pointer. In the case of invalid conversion, it returns NULL.<\/p>\n<p>The type trait\u00a0<em><strong>is_base_of&lt;&gt;<\/strong><\/em>\u00a0works with types and not actual objects.<\/p>\n<h3>Case-4: Class Hierarchy with Twists!<\/h3>\n<p>As the final example, let us consider a class hierarchy that uses <em><strong>protected<\/strong><\/em> derivation and also <em><strong>multiple derivation<\/strong><\/em> of a common base class.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<figure id=\"attachment_1985\" aria-describedby=\"caption-attachment-1985\" style=\"width: 614px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case4.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1985\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2020\/05\/09\/dynamic_cast-vs-stdis_base_of\/case4\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case4.jpg\" data-orig-size=\"614,884\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1589048576&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Case-4: Complex Hierarchy\" data-image-description=\"&lt;p&gt;Case-4: Complex Hierarchy&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Case-4: Complex Hierarchy&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case4.jpg\" class=\"size-full wp-image-1985\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case4.jpg?resize=614%2C884&#038;ssl=1\" alt=\"Case-4: Complex Hierarchy\" width=\"614\" height=\"884\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case4.jpg?w=614&amp;ssl=1 614w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case4.jpg?resize=208%2C300&amp;ssl=1 208w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/a><figcaption id=\"caption-attachment-1985\" class=\"wp-caption-text\"><strong>Case-4: Complex Hierarchy<\/strong><\/figcaption><\/figure>\n<p>Notice that class <em><strong>R<\/strong><\/em> is derived from <em><strong>Q<\/strong><\/em> using <em><strong>&#8220;protected&#8221;<\/strong><\/em> mode. Due to this, methods outside of <em><strong>R<\/strong><\/em> (global functions or methods of any class not derived from <em><strong>R<\/strong><\/em>) cannot access any member of <em><strong>Q<\/strong><\/em> via <em><strong>R<\/strong><\/em> instance. Interestingly, because of the non-public derivation,<span class=\"Apple-converted-space\">\u00a0 <\/span><em><strong>dynamic_cast&lt;&gt;<\/strong><\/em> fails in line 18 by returning NULL.<\/p>\n<p>Likewise, class <em><strong>S<\/strong><\/em> derives from <em><strong>P<\/strong><\/em> twice, via <em><strong>Q<\/strong><\/em> and <em><strong>R<\/strong><\/em>. This results in <em><strong>S<\/strong><\/em> object having two instances of <em><strong>P<\/strong><\/em> inside it. That is why, in lines 39-40, we first convert to <em><strong>void *<\/strong><\/em> then convert to <em><strong>P *<\/strong><\/em>. Of course, we get a run-time exception when we convert back to derived class through <em><strong>dynamic_cast&lt;&gt;<\/strong><\/em>.<\/p>\n<p>It is possible to consider some minor variations of the above examples, but I think you now have a good understanding of the difference between <em><strong>dynamic_cast&lt;&gt;<\/strong><\/em> and <em><strong>is_base_of&lt;&gt;<\/strong><\/em>.<\/p>\n<p>The example programs can be downloaded from <a href=\"http:\/\/www.rangakrish.com\/downloads\/DynamicCast.zip\" target=\"_blank\" rel=\"noopener\"><em><strong>here<\/strong><\/em><\/a>. I used\u00a0<em><strong>Visual Studio 2019 (64 bit), Version 16.5.4 <\/strong><\/em>to test these examples.<\/p>\n<p>Have a nice weekend!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the last article, we looked at the std:is_base_of&lt;T1, T2&gt; type trait. One question that a reader asked since that article appeared is &#8220;How does is_base_of&lt;&gt; differ from the dynamic_cast&lt;&gt; operator?&#8221; Good question! In today&#8217;s post let me try to address the key differences between the two. I am not going to cover the dynamic_cast&lt;&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[49,17],"tags":[67,238,237,235],"class_list":["post-1981","post","type-post","status-publish","format-standard","hentry","category-c","category-programming","tag-c","tag-dynamic_cast","tag-is_base_of","tag-type-trait"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-vX","jetpack-related-posts":[{"id":2011,"url":"https:\/\/www.rangakrish.com\/index.php\/2020\/06\/06\/stdis_trivial\/","url_meta":{"origin":1981,"position":0},"title":"std::is_trivial","author":"admin","date":"June 6, 2020","format":false,"excerpt":"Today let us try to understand the type trait std::is_trivial<T>. This trait checks if the given type is a trivial type. For a precise definition of what trivial means, please visit the official page. As usual, we will go through three cases: - Primitive types - Classes without inheritance -\u2026","rel":"","context":"In &quot;C++&quot;","block_context":{"text":"C++","link":"https:\/\/www.rangakrish.com\/index.php\/category\/c\/"},"img":{"alt_text":"Program Output","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/06\/output2.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3184,"url":"https:\/\/www.rangakrish.com\/index.php\/2023\/08\/13\/stdis_scoped_enum\/","url_meta":{"origin":1981,"position":1},"title":"std::is_scoped_enum","author":"admin","date":"August 13, 2023","format":false,"excerpt":"The type trait \"std::is_scoped_enum<T>::value\" was introduced in C++23 to check whether the type \u201cT\u201d is a scoped enum type. Another way to use this is std::is_scoped_enum_v<T>. Before getting into this trait in detail, let us briefly recap the differences between unscoped and scoped enums. Unscoped Enums Unscoped enums are the\u2026","rel":"","context":"In &quot;C++&quot;","block_context":{"text":"C++","link":"https:\/\/www.rangakrish.com\/index.php\/category\/c\/"},"img":{"alt_text":"Unscoped Enums","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/08\/unscoped-300x110.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/08\/unscoped-300x110.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/08\/unscoped-300x110.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1960,"url":"https:\/\/www.rangakrish.com\/index.php\/2020\/04\/12\/stdcommon_type-type-trait\/","url_meta":{"origin":1981,"position":2},"title":"std::common_type Type Trait","author":"admin","date":"April 12, 2020","format":false,"excerpt":"In today's post, I would like to go over the type trait std::common_type<>. This trait was introduced in C++11. As per the specification, std::common_type<T1, T2, ...Tn>::type refers to a type Tx in the given list, which the rest of the types in the list can be implicitly converted to. This\u2026","rel":"","context":"In &quot;C++&quot;","block_context":{"text":"C++","link":"https:\/\/www.rangakrish.com\/index.php\/category\/c\/"},"img":{"alt_text":"Program Output","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/04\/Fig5.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1973,"url":"https:\/\/www.rangakrish.com\/index.php\/2020\/04\/26\/stdis_base_of\/","url_meta":{"origin":1981,"position":3},"title":"std::is_base_of","author":"admin","date":"April 26, 2020","format":false,"excerpt":"In our on-going series on C++ Type Traits, today's topic is about the trait std::is_base_of<>. For the official description, see this. std::is_base_of<A, B>::value takes two arguments, both classes (or structs), and returns true if A is a base class of B and false otherwise. Trivially, std::<A, A>::value is true. Let\u2026","rel":"","context":"In &quot;C++&quot;","block_context":{"text":"C++","link":"https:\/\/www.rangakrish.com\/index.php\/category\/c\/"},"img":{"alt_text":"Output","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/04\/Output.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1946,"url":"https:\/\/www.rangakrish.com\/index.php\/2020\/03\/28\/stdis_empty\/","url_meta":{"origin":1981,"position":4},"title":"std::is_empty","author":"admin","date":"March 28, 2020","format":false,"excerpt":"In the previous post, we looked at the std::is_destructible<T> type trait. Today, let us try to understand another type trait std::is_empty<T>. As per the specification, is_empty<T>::value will return true in the following cases: - The class\/struct has no non-static data member - The class\/struct does not define a virtual function\u2026","rel":"","context":"In &quot;C++&quot;","block_context":{"text":"C++","link":"https:\/\/www.rangakrish.com\/index.php\/category\/c\/"},"img":{"alt_text":"Example4: Union and Bit Field","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/03\/Example4-1.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/03\/Example4-1.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/03\/Example4-1.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1992,"url":"https:\/\/www.rangakrish.com\/index.php\/2020\/05\/24\/stdis_convertible\/","url_meta":{"origin":1981,"position":5},"title":"std::is_convertible","author":"admin","date":"May 24, 2020","format":false,"excerpt":"The type trait is_convertible<From, To> checks if an object of type From can be \"implicitly\" converted to an object of type To. The expression is_convertible<From, To>::value returns true if implicit conversion is possible, else it returns false. For more details, please check out the reference. Let us look at three\u2026","rel":"","context":"In &quot;C++&quot;","block_context":{"text":"C++","link":"https:\/\/www.rangakrish.com\/index.php\/category\/c\/"},"img":{"alt_text":"Support for Implicit Conversion","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case3-1.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case3-1.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/05\/Case3-1.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/1981","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/comments?post=1981"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/1981\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=1981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=1981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=1981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}