{"id":366,"date":"2021-07-12T22:15:34","date_gmt":"2021-07-12T22:15:34","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=366"},"modified":"2021-09-14T05:21:12","modified_gmt":"2021-09-14T05:21:12","slug":"in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/cpp\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\/","title":{"rendered":"In c++ how are protected members of a base class accessed in derived class when inherited privately ?"},"content":{"rendered":"<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h4 id=\"in-c-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\" class=\"color-pink\" style=\"text-align: justify;\">In c++ how are protected members of a base class accessed in derived class when inherited privately ?<\/h4>\n<div class=\"row\" style=\"text-align: justify;\">\n<div class=\"col-sm-6\">\n<p>A. Privately<\/p>\n<\/div>\n<div class=\"col-sm-6\">\n<p>B. Publicly<\/p>\n<\/div>\n<div class=\"col-sm-6\">\n<p>C. Protectedly<\/p>\n<\/div>\n<div class=\"col-sm-6\">\n<p>D. Not Inherited<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 id=\"answer-a-privately\" style=\"text-align: justify;\"><b>Answer :\u00a0<\/b>A. Privately<\/h3>\n<div class=\"subheading\" style=\"text-align: justify;\">\n<h2 id=\"explanation\">Explanation:<\/h2>\n<\/div>\n<div class=\"Content\">\n<div class=\"hddn\">\n<ul>\n<li style=\"text-align: justify;\">Derived classes can access protected and public members of it\u2019s base class, and the derived class can not access the private members of it\u2019s base class.<\/li>\n<li>The private members are inherited for the following reason :\n<ul>\n<li style=\"text-align: justify;\">The base class can define a protected or public function that modifies the base class\u2019s private member.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Answer : A. Privately<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2080],"tags":[2252,195,2265,2251,491,360,368,211,2266,2267,2253,2254,2255,2256,2257,199,198,363,205,2258,2117,220,222,2122,2259,2260,2261,212,2120,2121,710,16276,207,366,204,217,2116,2262,2263,2264,2123,210,200,2118,2268,968,216,2119],"class_list":["post-366","post","type-post","status-publish","format-standard","hentry","category-cpp","tag-accessing-protected-members-in-a-derived-class","tag-accenture-interview-questions-and-answers","tag-access-specifiers-in-c-inheritance","tag-access-specifiers-in-c-inheritancec","tag-applied-materials-interview-questions-and-answers","tag-atos-interview-questions-and-answers","tag-bmc-software-interview-questions-and-answers","tag-bosch-india-software-interview-questions-and-answers","tag-c-accessing-protected-members-in-a-derived-class","tag-c-why-does-the-derived-class-inherit-the-private-members","tag-c-why-does-the-derived-class-inherit-the-private-members-of","tag-c-does-protected-inheritance-allow-the-derived-class-access","tag-c-protected-inheritance","tag-can-derived-class-access-private-members-of-base-class","tag-can-protected-members-be-accessed-by-objects","tag-casting-networks-india-pvt-limited-interview-questions-and-answers","tag-chetu-interview-questions-and-answers","tag-ciena-corporation-interview-questions-and-answers","tag-dell-international-services-india-pvt-ltd-interview-questions-and-answers","tag-derived-class-c","tag-einfochips-interview-questions-and-answers","tag-electronics-arts-inc-interview-questions-and-answers","tag-flipkart-interview-questions-and-answers","tag-harman-international-interview-questions-and-answers","tag-how-to-access-protected-members-in-a-derived-class","tag-how-to-access-protected-members-in-c","tag-if-a-base-class-member-access-is-public-and-an-inherited-class","tag-indecomm-global-services-interview-questions-and-answers","tag-larsen-toubro-interview-questions-and-answers","tag-mathworks-india-private-limited-interview-questions-and-answers","tag-mavenir-interview-questions-and-answers","tag-most-asked-sapient-nitro-interview-questions","tag-mphasis-interview-questions-and-answers","tag-netapp-interview-questions-and-answers","tag-oracle-corporation-interview-questions-and-answers","tag-peoplestrong-interview-questions-and-answers","tag-philips-software-centre-pvt-ltd-interview-questions-and-answers","tag-protected-in-c-with-example","tag-protected-members","tag-protected-members-inheritance-in-c","tag-srm-technologies-interview-questions-and-answers","tag-symphony-teleca-interview-questions-and-answers","tag-tech-mahindra-interview-questions-and-answers","tag-tecnotree-interview-questions-and-answers","tag-what-are-the-use-cases-of-protected-and-private-inheritance","tag-wipro-infotech-interview-questions-and-answers","tag-wipro-interview-questions-and-answers","tag-yash-technologies-interview-questions-and-answers"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>In c++ how are protected members of a base class accessed - V++<\/title>\n<meta name=\"description\" content=\"In c++ how are protected members of a base class accessed in derived class when inherited privately ? - Privately - The extent of Private information individuals stays\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/cpp\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"In c++ how are protected members of a base class accessed - V++\" \/>\n<meta property=\"og:description\" content=\"In c++ how are protected members of a base class accessed in derived class when inherited privately ? - Privately - The extent of Private information individuals stays\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/cpp\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-12T22:15:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-14T05:21:12+00:00\" \/>\n<meta name=\"author\" content=\"Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/cpp\\\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/cpp\\\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\\\/\"},\"author\":{\"name\":\"Editor\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\"},\"headline\":\"In c++ how are protected members of a base class accessed in derived class when inherited privately ?\",\"datePublished\":\"2021-07-12T22:15:34+00:00\",\"dateModified\":\"2021-09-14T05:21:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/cpp\\\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\\\/\"},\"wordCount\":102,\"commentCount\":0,\"keywords\":[\"++ - Accessing protected members in a derived class\",\"Accenture interview questions and answers\",\"access specifiers in c++ inheritance\",\"access specifiers in c++ inheritancec\",\"Applied Materials interview questions and answers\",\"Atos interview questions and answers\",\"BMC Software interview questions and answers\",\"Bosch India Software interview questions and answers\",\"c++ - Accessing protected members in a derived class\",\"c++ - why does the derived class inherit the private members\",\"c++ - why does the derived class inherit the private members of\",\"c++ Does protected inheritance allow the derived class access\",\"c++ protected inheritance\",\"Can derived class access private members of base class\",\"Can protected members be accessed by objects?\",\"CASTING NETWORKS INDIA PVT LIMITED interview questions and answers\",\"Chetu interview questions and answers\",\"Ciena Corporation interview questions and answers\",\"Dell International Services India Pvt Ltd interview questions and answers\",\"derived class c++\",\"eInfochips interview questions and answers\",\"Electronics Arts Inc interview questions and answers\",\"Flipkart interview questions and answers\",\"Harman International interview questions and answers\",\"How to access protected members in a derived class\",\"how to access protected members in c++\",\"If a base class member access is public and an inherited class\",\"Indecomm Global Services interview questions and answers\",\"Larsen &amp; Toubro interview questions and answers\",\"Mathworks India Private Limited interview questions and answers\",\"Mavenir interview questions and answers\",\"Most Asked Sapient Nitro Interview Questions\",\"Mphasis interview questions and answers\",\"NetApp interview questions and answers\",\"Oracle Corporation interview questions and answers\",\"PeopleStrong interview questions and answers\",\"Philips Software Centre Pvt Ltd interview questions and answers\",\"protected in c++ with example\",\"Protected members\",\"protected members inheritance in c++\",\"SRM Technologies interview questions and answers\",\"Symphony Teleca interview questions and answers\",\"Tech Mahindra interview questions and answers\",\"Tecnotree interview questions and answers\",\"What are the use cases of protected and private inheritance\",\"Wipro Infotech interview questions and answers\",\"Wipro interview questions and answers\",\"Yash Technologies interview questions and answers\"],\"articleSection\":[\"C++\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/cpp\\\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/cpp\\\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\\\/\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/cpp\\\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\\\/\",\"name\":\"In c++ how are protected members of a base class accessed - V++\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\"},\"datePublished\":\"2021-07-12T22:15:34+00:00\",\"dateModified\":\"2021-09-14T05:21:12+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\"},\"description\":\"In c++ how are protected members of a base class accessed in derived class when inherited privately ? - Privately - The extent of Private information individuals stays\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/cpp\\\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\\\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\",\"name\":\"Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"caption\":\"Editor\"},\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/author\\\/editor\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"In c++ how are protected members of a base class accessed - V++","description":"In c++ how are protected members of a base class accessed in derived class when inherited privately ? - Privately - The extent of Private information individuals stays","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:\/\/www.wikitechy.com\/interview-questions\/cpp\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\/","og_locale":"en_US","og_type":"article","og_title":"In c++ how are protected members of a base class accessed - V++","og_description":"In c++ how are protected members of a base class accessed in derived class when inherited privately ? - Privately - The extent of Private information individuals stays","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/cpp\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\/","og_site_name":"Wikitechy","article_published_time":"2021-07-12T22:15:34+00:00","article_modified_time":"2021-09-14T05:21:12+00:00","author":"Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Editor","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.wikitechy.com\/interview-questions\/cpp\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\/#article","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/cpp\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\/"},"author":{"name":"Editor","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"headline":"In c++ how are protected members of a base class accessed in derived class when inherited privately ?","datePublished":"2021-07-12T22:15:34+00:00","dateModified":"2021-09-14T05:21:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/cpp\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\/"},"wordCount":102,"commentCount":0,"keywords":["++ - Accessing protected members in a derived class","Accenture interview questions and answers","access specifiers in c++ inheritance","access specifiers in c++ inheritancec","Applied Materials interview questions and answers","Atos interview questions and answers","BMC Software interview questions and answers","Bosch India Software interview questions and answers","c++ - Accessing protected members in a derived class","c++ - why does the derived class inherit the private members","c++ - why does the derived class inherit the private members of","c++ Does protected inheritance allow the derived class access","c++ protected inheritance","Can derived class access private members of base class","Can protected members be accessed by objects?","CASTING NETWORKS INDIA PVT LIMITED interview questions and answers","Chetu interview questions and answers","Ciena Corporation interview questions and answers","Dell International Services India Pvt Ltd interview questions and answers","derived class c++","eInfochips interview questions and answers","Electronics Arts Inc interview questions and answers","Flipkart interview questions and answers","Harman International interview questions and answers","How to access protected members in a derived class","how to access protected members in c++","If a base class member access is public and an inherited class","Indecomm Global Services interview questions and answers","Larsen &amp; Toubro interview questions and answers","Mathworks India Private Limited interview questions and answers","Mavenir interview questions and answers","Most Asked Sapient Nitro Interview Questions","Mphasis interview questions and answers","NetApp interview questions and answers","Oracle Corporation interview questions and answers","PeopleStrong interview questions and answers","Philips Software Centre Pvt Ltd interview questions and answers","protected in c++ with example","Protected members","protected members inheritance in c++","SRM Technologies interview questions and answers","Symphony Teleca interview questions and answers","Tech Mahindra interview questions and answers","Tecnotree interview questions and answers","What are the use cases of protected and private inheritance","Wipro Infotech interview questions and answers","Wipro interview questions and answers","Yash Technologies interview questions and answers"],"articleSection":["C++"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.wikitechy.com\/interview-questions\/cpp\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/cpp\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/cpp\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\/","name":"In c++ how are protected members of a base class accessed - V++","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"datePublished":"2021-07-12T22:15:34+00:00","dateModified":"2021-09-14T05:21:12+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"description":"In c++ how are protected members of a base class accessed in derived class when inherited privately ? - Privately - The extent of Private information individuals stays","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/cpp\/in-cpp-how-are-protected-members-of-a-base-class-accessed-in-derived-class-when-inherited-privately\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757","name":"Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","caption":"Editor"},"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/editor\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=366"}],"version-history":[{"count":3,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/366\/revisions"}],"predecessor-version":[{"id":3625,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/366\/revisions\/3625"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}