{"id":226,"date":"2020-09-01T10:33:30","date_gmt":"2020-09-01T10:33:30","guid":{"rendered":"https:\/\/www.kindsonthegenius.com\/cplusplus\/?p=226"},"modified":"2020-09-01T10:33:30","modified_gmt":"2020-09-01T10:33:30","slug":"c-oop-inheritance","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/","title":{"rendered":"C++ OOP &#8211; Inheritance"},"content":{"rendered":"<p>In the previous lesson we covered the <a href=\"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-constructors\/\" target=\"_blank\" rel=\"noopener noreferrer\">Constructors<\/a>. In this lesson, we would examine yet another OOP concept: <strong><em>Inheritance<\/em><\/strong>. The following topics will be addressed:<\/p>\n<ol>\n<li><a href=\"#t1\">Overview of C++ Inheritance<\/a><\/li>\n<li><a href=\"#t2\">Access Specifiers<\/a><\/li>\n<li><a href=\"#t3\">Inheritance Access Modes<\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t1\">1. Overview of C++ Inheritance<\/strong><\/h4>\n<p>As mentioned, inheritance is a key feature of OOP. It is a feature that allows to create a new class based on an existing class. And clearly, this aligns with the DRY(don&#8217;t repeat yourself) principle.<\/p>\n<p>In writing a new class, the new class can derive functionalities, such as data members from existing class. Therefore the new class is called a <strong>derived class<\/strong> while the existing class is called a <strong>base class<\/strong>. Other terms care <strong>parent class<\/strong> and <strong>child class<\/strong>. It could also be <strong>superclass and subclass<\/strong>.<\/p>\n<p>Inheritance implements is-a relationship as shown in the figure.<\/p>\n<p><a href=\"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2020\/09\/Inheritance-in-C.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-228 aligncenter\" src=\"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2020\/09\/Inheritance-in-C-300x121.jpg\" alt=\"Inheritance in C++\" width=\"300\" height=\"121\" srcset=\"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2020\/09\/Inheritance-in-C-300x121.jpg 300w, https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2020\/09\/Inheritance-in-C.jpg 683w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Let&#8217;s take an example:<\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #888888;\">\/\/ Base class<\/span>\r\n<span style=\"color: #008800; font-weight: bold;\">class<\/span> <span style=\"color: #bb0066; font-weight: bold;\">Vehicle<\/span> {\r\n  <span style=\"color: #997700; font-weight: bold;\">public:<\/span>\r\n    string make <span style=\"color: #333333;\">=<\/span> <span style=\"background-color: #fff0f0;\">\"Toyota\"<\/span>;\r\n    <span style=\"color: #333399; font-weight: bold;\">void<\/span> <span style=\"color: #0066bb; font-weight: bold;\">honk<\/span>() {\r\n      cout <span style=\"color: #333333;\">&lt;&lt;<\/span> <span style=\"background-color: #fff0f0;\">\"Poom poom! <\/span><span style=\"color: #666666; font-weight: bold; background-color: #fff0f0;\">\\n<\/span><span style=\"background-color: #fff0f0;\">\"<\/span> ;\r\n    }\r\n};\r\n\r\n<span style=\"color: #888888;\">\/\/ Derived class of Vehicle<\/span>\r\n<span style=\"color: #008800; font-weight: bold;\">class<\/span> <span style=\"color: #bb0066; font-weight: bold;\">Car<\/span><span style=\"color: #333333;\">:<\/span> <span style=\"color: #008800; font-weight: bold;\">public<\/span> Vehicle {\r\n  <span style=\"color: #997700; font-weight: bold;\">public:<\/span>\r\n    string model <span style=\"color: #333333;\">=<\/span> <span style=\"background-color: #fff0f0;\">\"Corolla\"<\/span>;\r\n};\r\n\r\n<span style=\"color: #333399; font-weight: bold;\">int<\/span> <span style=\"color: #0066bb; font-weight: bold;\">main<\/span>() {\r\n  Car car1;\r\n  car1.honk();\r\n  cout <span style=\"color: #333333;\">&lt;&lt;<\/span> car1.make <span style=\"color: #333333;\">+<\/span> <span style=\"background-color: #fff0f0;\">\" \"<\/span> <span style=\"color: #333333;\">+<\/span> car1.model;\r\n  <span style=\"color: #008800; font-weight: bold;\">return<\/span> <span style=\"color: #0000dd; font-weight: bold;\">0<\/span>;\r\n}\r\n<\/pre>\n<p>Here, the <em><strong>Car<\/strong> <\/em>class derives from the <strong><em>Vehicle<\/em> <\/strong>class. Since car derives from Vehicle, the member of Vehicle are accessible to <em><strong>Car<\/strong><\/em>.<\/p>\n<p>One thing you should observe is the use of the keyword public while inheriting Car from Vehicle.<\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #008800; font-weight: bold;\">class<\/span> <span style=\"color: #bb0066; font-weight: bold;\">Car<\/span><span style=\"color: #333333;\">:<\/span> <span style=\"color: #008800; font-weight: bold;\">public<\/span> Vehicle {\r\n   ...\r\n};\r\n<\/pre>\n<p>The public keyword here is an<em><strong> access specifier<\/strong><\/em> and defines the<em><strong> access mode<\/strong><\/em> of the inheritance. We&#8217;ll now talk about access specifiers. Then we move on to access modes.<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t2\">2. Access Specifiers<\/strong><\/h4>\n<p>By now, you have seen from previous examples that members of a class can be public. They can also be private or protected. These are called access specifiers. They specify how members of a class can be accessed. For example, the<strong> public members<\/strong> can be accessed from outside the class. The three access modifiers for class members are explained below.<\/p>\n<ul>\n<li><strong>public<\/strong> &#8211; members are accessible from outside of the class<\/li>\n<li><strong>private<\/strong> &#8211; members are not visible from outside the class<\/li>\n<li><strong>protected<\/strong> &#8211; members are accessible from outside the class only by derived classes.<\/li>\n<\/ul>\n<p>The program below illustrates this. There are 3 error I&#8217;ve indicated. Check to understand the reason behind each error<\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #557799;\">#include &lt;iostream&gt;<\/span>\r\n\r\n<span style=\"color: #008800; font-weight: bold;\">using<\/span> <span style=\"color: #008800; font-weight: bold;\">namespace<\/span> std;\r\n\r\n<span style=\"color: #888888;\">\/\/ declare a class, shape<\/span>\r\n<span style=\"color: #008800; font-weight: bold;\">class<\/span>  <span style=\"color: #bb0066; font-weight: bold;\">Shape<\/span> {\r\n\r\n  <span style=\"color: #997700; font-weight: bold;\">private:<\/span>\r\n       <span style=\"color: #333399; font-weight: bold;\">double<\/span> height <span style=\"color: #333333;\">=<\/span> <span style=\"color: #6600ee; font-weight: bold;\">12.3<\/span>;\r\n\r\n  <span style=\"color: #997700; font-weight: bold;\">public:<\/span>\r\n       <span style=\"color: #333399; font-weight: bold;\">double<\/span> width <span style=\"color: #333333;\">=<\/span> <span style=\"color: #6600ee; font-weight: bold;\">9.2<\/span>;\r\n\r\n  <span style=\"color: #997700; font-weight: bold;\">protected:<\/span>\r\n       <span style=\"color: #333399; font-weight: bold;\">double<\/span> length <span style=\"color: #333333;\">=<\/span> <span style=\"color: #6600ee; font-weight: bold;\">34.02<\/span>;\r\n\r\n};\r\n\r\n<span style=\"color: #888888;\">\/\/ create a derived class cube<\/span>\r\n<span style=\"color: #008800; font-weight: bold;\">class<\/span> <span style=\"color: #bb0066; font-weight: bold;\">Circle<\/span><span style=\"color: #333333;\">:<\/span> Shape {\r\n\r\n<span style=\"color: #997700; font-weight: bold;\">public:<\/span>\r\n\t<span style=\"color: #333399; font-weight: bold;\">void<\/span> getValues(){\r\n\r\n\t\theight <span style=\"color: #333333;\">=<\/span> <span style=\"color: #6600ee; font-weight: bold;\">89.2<\/span>; <span style=\"color: #888888;\">\/\/3. Error: private member<\/span>\r\n\r\n\t\tlength <span style=\"color: #333333;\">=<\/span> <span style=\"color: #6600ee; font-weight: bold;\">23.3<\/span>; <span style=\"color: #888888;\">\/\/Ok: derived class<\/span>\r\n\t}\r\n};\r\n\r\n\r\n<span style=\"color: #333399; font-weight: bold;\">int<\/span> <span style=\"color: #0066bb; font-weight: bold;\">main<\/span>() {\r\n\r\n\tShape shape1;\r\n\r\n\tshape1.height <span style=\"color: #333333;\">=<\/span> <span style=\"color: #6600ee; font-weight: bold;\">9.3<\/span>; <span style=\"color: #888888;\">\/\/1. Error: private member<\/span>\r\n\r\n\tshape1.length <span style=\"color: #333333;\">=<\/span> <span style=\"color: #6600ee; font-weight: bold;\">10.2<\/span>; <span style=\"color: #888888;\">\/\/2. Error: protected member<\/span>\r\n\r\n\tshape1.width <span style=\"color: #333333;\">=<\/span> <span style=\"color: #6600ee; font-weight: bold;\">34.08<\/span>; <span style=\"color: #888888;\">\/\/OK: public member<\/span>\r\n\r\n    <span style=\"color: #008800; font-weight: bold;\">return<\/span> <span style=\"color: #0000dd; font-weight: bold;\">0<\/span>;\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t2\">3. Inheritance Access Mode(public, private, protected)<\/strong><\/h4>\n<p>The access mode(also called types of inheritance) defines the ways classes can be derived. In order words, how much of the parents functionalities are inherited by the child. Let&#8217;s see.<\/p>\n<ul>\n<li><strong>public<\/strong>: if a child class is derived using the public mode, then the members of the base class are inherited exactly as they are<\/li>\n<li><strong>private<\/strong>:if a child class is derived with the private mode, then the members of the base class now become private members of the derived class.<\/li>\n<li><strong>protected<\/strong>:in this case, public members of the base class become protected members of the derived class.<\/li>\n<li><strong>default:<\/strong> when you don&#8217;t specify and access mode, then it&#8217;s automatically public.<\/li>\n<\/ul>\n<p>In subsequent lessons, we&#8217;ll cover other aspects of inheritance including: multiple inheritance and function overloading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the previous lesson we covered the Constructors. In this lesson, we would examine yet another OOP concept: Inheritance. The following topics will be addressed: &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2,35],"tags":[38],"class_list":["post-226","post","type-post","status-publish","format-standard","hentry","category-c-tutorials","category-oop","tag-inheritance"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>C++ OOP - Inheritance - C++ Tutorials<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++ OOP - Inheritance - C++ Tutorials\" \/>\n<meta property=\"og:description\" content=\"In the previous lesson we covered the Constructors. In this lesson, we would examine yet another OOP concept: Inheritance. The following topics will be addressed: &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/\" \/>\n<meta property=\"og:site_name\" content=\"C++ Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2020-09-01T10:33:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2020\/09\/Inheritance-in-C-300x121.jpg\" \/>\n<meta name=\"author\" content=\"kindsonthegenius\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"kindsonthegenius\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/c-oop-inheritance\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/c-oop-inheritance\\\/\"},\"author\":{\"name\":\"kindsonthegenius\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/#\\\/schema\\\/person\\\/59a11a9f72bb132f56f91ab9f8a58a0e\"},\"headline\":\"C++ OOP &#8211; Inheritance\",\"datePublished\":\"2020-09-01T10:33:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/c-oop-inheritance\\\/\"},\"wordCount\":465,\"commentCount\":2,\"image\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/c-oop-inheritance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/Inheritance-in-C-300x121.jpg\",\"keywords\":[\"Inheritance\"],\"articleSection\":[\"C++ Tutorials\",\"OOP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/c-oop-inheritance\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/c-oop-inheritance\\\/\",\"url\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/c-oop-inheritance\\\/\",\"name\":\"C++ OOP - Inheritance - C++ Tutorials\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/c-oop-inheritance\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/c-oop-inheritance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/Inheritance-in-C-300x121.jpg\",\"datePublished\":\"2020-09-01T10:33:30+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/#\\\/schema\\\/person\\\/59a11a9f72bb132f56f91ab9f8a58a0e\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/c-oop-inheritance\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/c-oop-inheritance\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/c-oop-inheritance\\\/#primaryimage\",\"url\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/Inheritance-in-C.jpg\",\"contentUrl\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/Inheritance-in-C.jpg\",\"width\":683,\"height\":276,\"caption\":\"Inheritance in C++\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/c-oop-inheritance\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C++ OOP &#8211; Inheritance\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/#website\",\"url\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/\",\"name\":\"C++ Tutorials\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/#\\\/schema\\\/person\\\/59a11a9f72bb132f56f91ab9f8a58a0e\",\"name\":\"kindsonthegenius\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"caption\":\"kindsonthegenius\"},\"url\":\"https:\\\/\\\/kindsonthegenius.com\\\/cplusplus\\\/author\\\/kindsonthegenius-3\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C++ OOP - Inheritance - C++ Tutorials","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:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/","og_locale":"en_US","og_type":"article","og_title":"C++ OOP - Inheritance - C++ Tutorials","og_description":"In the previous lesson we covered the Constructors. In this lesson, we would examine yet another OOP concept: Inheritance. The following topics will be addressed: &hellip;","og_url":"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/","og_site_name":"C++ Tutorials","article_published_time":"2020-09-01T10:33:30+00:00","og_image":[{"url":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2020\/09\/Inheritance-in-C-300x121.jpg","type":"","width":"","height":""}],"author":"kindsonthegenius","twitter_card":"summary_large_image","twitter_misc":{"Written by":"kindsonthegenius","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/#article","isPartOf":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/"},"author":{"name":"kindsonthegenius","@id":"https:\/\/kindsonthegenius.com\/cplusplus\/#\/schema\/person\/59a11a9f72bb132f56f91ab9f8a58a0e"},"headline":"C++ OOP &#8211; Inheritance","datePublished":"2020-09-01T10:33:30+00:00","mainEntityOfPage":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/"},"wordCount":465,"commentCount":2,"image":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/#primaryimage"},"thumbnailUrl":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2020\/09\/Inheritance-in-C-300x121.jpg","keywords":["Inheritance"],"articleSection":["C++ Tutorials","OOP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/","url":"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/","name":"C++ OOP - Inheritance - C++ Tutorials","isPartOf":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/#primaryimage"},"image":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/#primaryimage"},"thumbnailUrl":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2020\/09\/Inheritance-in-C-300x121.jpg","datePublished":"2020-09-01T10:33:30+00:00","author":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/#\/schema\/person\/59a11a9f72bb132f56f91ab9f8a58a0e"},"breadcrumb":{"@id":"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/#primaryimage","url":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2020\/09\/Inheritance-in-C.jpg","contentUrl":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-content\/uploads\/2020\/09\/Inheritance-in-C.jpg","width":683,"height":276,"caption":"Inheritance in C++"},{"@type":"BreadcrumbList","@id":"https:\/\/kindsonthegenius.com\/cplusplus\/c-oop-inheritance\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kindsonthegenius.com\/cplusplus\/"},{"@type":"ListItem","position":2,"name":"C++ OOP &#8211; Inheritance"}]},{"@type":"WebSite","@id":"https:\/\/kindsonthegenius.com\/cplusplus\/#website","url":"https:\/\/kindsonthegenius.com\/cplusplus\/","name":"C++ Tutorials","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kindsonthegenius.com\/cplusplus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/kindsonthegenius.com\/cplusplus\/#\/schema\/person\/59a11a9f72bb132f56f91ab9f8a58a0e","name":"kindsonthegenius","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","caption":"kindsonthegenius"},"url":"https:\/\/kindsonthegenius.com\/cplusplus\/author\/kindsonthegenius-3\/"}]}},"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/posts\/226","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/comments?post=226"}],"version-history":[{"count":2,"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/posts\/226\/revisions"}],"predecessor-version":[{"id":229,"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/posts\/226\/revisions\/229"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/media?parent=226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/categories?post=226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/cplusplus\/wp-json\/wp\/v2\/tags?post=226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}